cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
user name:
password:
Forgot your password?
please wait
try again
cancel
forgot your password?
sign up
log in
[Legacy version]
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
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
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.