object of a baseClass referenced to a derived class

what is the difference between


 
  BaseClass Base=new DerivedClass()

AND
BaseClass Base=new BaseClass()
You probably meant BaseClass* Base

The difference is that in first case pointer will actually point to the derived object and virtual function will be executed based on real type of the object.
Topic archived. No new replies allowed.