Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# inheritance

//Example of inheritence
using System;  
public class Parent  
{  
    public string parent_description = "This is parent class";  
}  
//child class inherits parent class
public class Child: Parent
{  
    public string child_description = "This is child class";  
}  
class TestInheritance
{  
     public static void Main(string[] args)  
     {  
         Child d = new Child();  
 		 Console.WriteLine(d.parent_description);  
         Console.WriteLine(d.child_description);  
  
     }  
}  
Source by www.programiz.com #
 
PREVIOUS NEXT
Tagged: #inheritance
ADD COMMENT
Topic
Name
9+1 =