Blog Stats
  • Posts - 42
  • Articles - 0
  • Comments - 98
  • Trackbacks - 34

 

August 2005 Entries

Base class and Derived class relationship in C#.Net

/* 1) Base obj = new Derived(); * Untill and unless you've a method overridden * in the derived class, whether or not you say "new method" * in the derived class, the base class's * method would get called. */Salary objBaseDerSalary = new DerivedSalary() ;MessageBox.Show("objBaseDe... " + objBaseDerSalary.myMethod()); /* 2) Derived obj = new Base(); * Gives compilation error, because the parent * cannot be implicitely converted to the derived. * DerivedSalary objBaseDerSalary1 = new...

 

 

Copyright © Vinayak