[LC++]Playing with polymorphism

Peter Poulsen peter_poulsen at stofanet.dk
Mon Apr 19 13:43:01 UTC 2004


I have this very small program (http://www.pgpnet.dk/test.cc). It is a
bit hard to explain what it does but the program is _very_ small and you
will probably not have any problems understanding it. What I don't
understand is why I have to cast a B pointer to an A pointer when
calling load as B is a descendent of A? Can anybody explain that to me?

BTW It may look a bit weird that I'm passing a reference to a pointer,
but is because that I in the real program needs to return to
pointers. And as we all know, functions/methods only allow one return value.

-- 
Yours 
Peter Poulsen




More information about the tuxCPProgramming mailing list