Decipher, it is desirable to explain by example ...

In general, a pointer to an object of one type cannot point to an object of another type ... In C ++, a pointer-reference to a base class can indicate-refer to an object of a derived class-type ...

Give an example code ... Thank you!

    2 answers 2

    class Base {}; class Derived : public Base {}; main() { Base* base = new Derived(); // указатель на базовый класс фактически ссылается на объект производного класса. } 
    • Thank. All my inattention. - fogbit

    In general, a pointer to an object of one type cannot point to an object of another type ... In C ++, a pointer-reference to a base class can indicate-refer to an object of a derived class-type ...

    Also, a pointer of type void * can refer to any object.