Interface tutorial's example

In the first (and further) example of interface's tutorial..this is used
" CRectangle rect;
CTriangle trgl;

CPolygon * ppoly1 = ▭
CPolygon * ppoly2 = &trgl;

ppoly1->set_values (4,5);
ppoly2->set_values (4,5);
"

I can use this also-
" rect.set_values (4,5);
trgl.set_values (4,5);
"

WHY SHOULD I USE THE EARLIER ONE???? WHY IS IT SPECIAL??? WHAT ARE THE SPECIAL FETURES??
WHY SHOULD I USE THE EARLIER ONE????


BECAUSE SOMETIMES YOU HAVE A POINTER TO AN OBJECT RATHER THAN THE OBJECT ITSELF, FOR EXAMPLE IF YOU CREATE AN OBJECT USING NEW.
okay.
any why making pointer of base class'es type more important that of derived class'es type..?
It's not more important. They're both useful in the right place.
Last edited on
okay..concept is clear now. Thanks a lot !
Topic archived. No new replies allowed.