Does a Base Class know it's instanced class?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to have methods in my base class that use reflection against its
derived class.

Is there any way for my base class to access its derived class? It does not
appear to be the case.

If not, how bad (programming practice-wise) is it to have a property in the
base class that references the instanced class? Or via the base class,
instance another object that has a reference to the instanced class.
 
Is there any way for my base class to access its derived class?

Sure, once you have an instance of the derived class. For example,
this.GetType() returns the actual type of the object.


Mattias
 
Back
Top