Quote Originally Posted by newHere
actually, I am trying to write a fun() that can take the base class (Base) object or any derived classes (A, B) objects and prints the correct size of the pass in object, which I failed in the above code.
sizeof is an operator whose result is determined at compile time. The object that the base reference refers to can vary at run time. As such, you are asking for the impossible (except in special cases, or possibly by overloading, which may not be quite what you want).

By the way, get rid of the semi-colons after your function definitions. Note that the global main function should return an int, not void.