G
Greg Bacchus
I have a base class with a method that is to be called in the constructor of
the inheritting classes. Is there any way of determining, say, the Type of
the class that is calling it.
e.g.
class A
{
public A()
{
AddStuff();
}
protected void AddStuff()
{
//do stuff
}
}
class B : A
{
public B()
{
AddStuff();
}
}
class C : B
{
public C()
{
AddStuff();
}
}
So when I create an instance of C, AddStuff() will be called by each of the
three constructors, but I need to know which constructor was calling it (so
in know the context to which I should add the stuff).
Hope that makes some sort of sense.
Greg
the inheritting classes. Is there any way of determining, say, the Type of
the class that is calling it.
e.g.
class A
{
public A()
{
AddStuff();
}
protected void AddStuff()
{
//do stuff
}
}
class B : A
{
public B()
{
AddStuff();
}
}
class C : B
{
public C()
{
AddStuff();
}
}
So when I create an instance of C, AddStuff() will be called by each of the
three constructors, but I need to know which constructor was calling it (so
in know the context to which I should add the stuff).
Hope that makes some sort of sense.
Greg