Pointers
-
No pointer, no polymorphism.
-
C/C++ is notorious for raw pointers. While pointers can boost up the speed of programs, it invites a trillion chances for making mistakes. You should avoid using raw pointers, instead, consider using
unique_ptr
,shared_ptr
andweak_ptr
. They are almost as efficient as raw pointers but much safer to use. -
If
p
is a dynamically allocated array, you have to usedelete[] p
to delete it when it is no longer required. -
auto_ptr
objects cannot be stored in STL containers, because they are not copy-construable or assignable.