L
Leon
Hi, I am trying to design a class, which calls all a specific virtual
function from all it's subclasses. Like this:
class Base
{
public:
virtual void theFunction() { // stuff goes here };
};
class firstDerived : public Base
{
public:
virtual void theFunction() { // stuff goes here };
};
class secondDerived : public firstDerived
{
public:
virtual void theFunction() { // stuff goes here };
};
int main()
{
secondDerived* theClass = new secondDerived;
((Base*)secondDerived)->theFunction();
}
Now I want to let the last line (((Base*)secondDerived)->theFunction()
call all of the theFunction()'s (the base's one, the first derived's one,
and the second derived's one. (without pointers to the
secondDerived::theFunction())
Is this possible?
Leon
function from all it's subclasses. Like this:
class Base
{
public:
virtual void theFunction() { // stuff goes here };
};
class firstDerived : public Base
{
public:
virtual void theFunction() { // stuff goes here };
};
class secondDerived : public firstDerived
{
public:
virtual void theFunction() { // stuff goes here };
};
int main()
{
secondDerived* theClass = new secondDerived;
((Base*)secondDerived)->theFunction();
}
Now I want to let the last line (((Base*)secondDerived)->theFunction()
call all of the theFunction()'s (the base's one, the first derived's one,
and the second derived's one. (without pointers to the
secondDerived::theFunction())
Is this possible?
Leon