First off, prt is of type Base.
You assigned it the address of dv.
Which is of type Derv.
But because ptr is of class type Base, it will only associate with the members it can access; scope narrowing scheme.
A is the base class
B is the derived class
B has an A object within it.
So when an A object points to a B object.
It will have a scope of type A, even though it is addressing a type B address.
Image, casting a double to int.
Or better yet, pointing an int pointer at a double address.
Hope this helps.
Edited:
Just to point out, some compilers will allow void main()
Mines does not, if you aren't getting any issue - no concerns.
If you are, use int main(). The "return 0;" is passively invoked even if you don't call it - hence why successfully completed programs return 0 upon completion.