Perhaps, why I need it would be more enlightening .
I have a class called token. A class called Literal is derived from it.
Now, look at the following code:
How should I access Literal `s data or functions from the pointer t itself ?Code:token* t = token_factory("7479"); //token_factory() returns a pointer to a Literal(or other subclasses as appropriate from the argument) allocated and constructed. cout<< t->num; //Literals are supposed to have a member called num, but the compiler doesn't know that t is internally pointing to a Literal.