Define base class another cs file : Base Class : Class C# Examples


C# Examples » Class » Base Class »

 

Define base class another cs file









    
//File:  base.cs
using  System;


namespace  BaseClassNS
{
      public  class  MyBaseClass
      {
            public  void  PrintMe()
            {
                  Console.WriteLine("I  am  MyBaseClass");
            }
      }
}

//////////////////////////////////////
//MainClass.cs

using  System;
using  BaseClassNS;

namespace  UsesBaseClass
{
      class  DerivedClass  :  MyBaseClass
      {
      }

      class  MainClass
      {
            static  void  Main()
            {
                  DerivedClass  mdc  =  new  DerivedClass();
                  mdc.PrintMe();
            }
      }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Class
» Base Class