Friday, November 28, 2003

Re: Polymorphism

glad u cleared all of that .. thank u :)

This is just a minor thing, but I don't think this is correct...

(*g)->pr()

g is an iterator. An iterator behaves like a pointer. When you dereference an iterator, just like a pointer, you get back an object. So you have to use the dot operator, not the arrow....

(*g).pr();

Like I said, no big deal.


i think u forgot that the vector is holding Base* .. so *g will dereference to a Base* .. hence got to use (*g)->pr();

dinesh.

No comments: