adplus-dvertising
frame-decoration

Question

If two classes are defined “Parent” and “Child” then which is the correct type upcast syntax in C++?

a.

Parent *p=child;

b.

Parent *p=*child;

c.

Parent *p=&child;

d.

Parent *p=Child();

Answer: (c).Parent *p=&child;

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. If two classes are defined “Parent” and “Child” then which is the correct type upcast syntax in C++?