abc qw = new pqr();
Because, although you have created an object of type
pqr
you have assigned it to an object of type
abc
. So, you are telling the compiler that you will only access properties that are accessible to an
abc
type. This is a language restriction which is described in Bjarne Stroustrup's
C++ page[
^].