I am trying to understand class pointer. I have a seen a lot of people use it on the forum. Hence, my questions are as follows below
1. What is the benefit of it?
2. Are there any good tutorials explaining in detail on it? because unfortunately when I go online to search for it I am not able to find good tutorials on it.
thanks in advance
ford_pinto * car;
car = new ford_pinto;
// Do something with car
delete car; // Done with car. Free the memory
Pointers can get messy when you have multiple pointers pointing to the same object.
2) When you want to use polymorphism. In this case you have a base class and typically two or more derived classes. You should be able to find lots of articles on polymorphism. http://www.cplusplus.com/doc/tutorial/polymorphism/