How the C++ polimorphism work with pointers? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

How the C++ polimorphism work with pointers?

if I declare a pointer of A, he point to memory for A size. but if the pointer point to B object, who is inherite from A, the size of memory should be bigger?

17th Mar 2017, 3:12 PM
ā€«×‘×Øוך ×Øוטקוףā€¬ā€Ž
ā€«×‘×Øוך ×Øוטקוףā€¬ā€Ž - avatar
1 Resposta
0
Yes, but actually, you shouldn't take care about it. Just use the pointers and compiler will do its work. All pointers themselves have the same size.
30th Mar 2017, 10:41 PM
soman