Advertisement
NAK

Inheritance (simple)(C#)

NAK
Dec 5th, 2013
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Inheritance
  8. {
  9.     public class Program
  10.     {
  11.  
  12.         public static void Main()
  13.         {
  14.             Console.WriteLine("Create instance of DerivedClass.....");
  15.             DerivedClass derivedclass = new DerivedClass();
  16.             // the next line calls the print function in our base class
  17.             derivedclass.Print();
  18.         }
  19.     }
  20. }
  21. // Our Base class
  22. public class BaseClass
  23. {
  24.     public void Print()
  25.     {
  26.         Console.WriteLine("call Print() function from BaseClass");
  27.     }
  28. }
  29. // Our Derived class that inherits from our Base Class
  30. public class DerivedClass : BaseClass
  31. {
  32.     // note that there is no code here
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement