cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Polymorphism C++
Polymorphism C++
May 8, 2013 at 2:40am UTC
jaden5165
(54)
CPolygon * ppoly1 =
new
CRectangle;
DOes it mean poly1 can either point to type of Cpolygon or Crectangle?
May 8, 2013 at 3:19am UTC
Lachlan Easton
(699)
Yes (Assuming CRectangle is derived from CPolygon), this is because CRectagle
IS
a CPolygon. A pointer to a type T can point to any object that is derived from type T.
Topic archived. No new replies allowed.