[try Beta version]
Not logged in

 
object of a baseClass referenced to a derived class

Oct 4, 2014 at 9:55pm
what is the difference between


 
  BaseClass Base=new DerivedClass()

AND
BaseClass Base=new BaseClass()
Oct 4, 2014 at 10:00pm
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.