cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
object of a baseClass referenced to a de
object of a baseClass referenced to a derived class
Oct 4, 2014 at 9:55pm UTC
Sharan123
(352)
what is the difference between
BaseClass Base=
new
DerivedClass()
AND
BaseClass Base=
new
BaseClass()
Oct 4, 2014 at 10:00pm UTC
MiiNiPaa
(8886)
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.