Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Inheritance
- {
- public class Program
- {
- public static void Main()
- {
- Console.WriteLine("Create instance of DerivedClass.....");
- DerivedClass derivedclass = new DerivedClass();
- // the next line calls the print function in our base class
- derivedclass.Print();
- }
- }
- }
- // Our Base class
- public class BaseClass
- {
- public void Print()
- {
- Console.WriteLine("call Print() function from BaseClass");
- }
- }
- // Our Derived class that inherits from our Base Class
- public class DerivedClass : BaseClass
- {
- // note that there is no code here
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement