Would you like to react to this message? Create an account in a few clicks or log in to continue.



 
HomeThe LoungeLatest imagesSearchRegisterLog in

 

 How do I make a dynamic array of pointers to an abstract class in C++?

Go down 
AuthorMessage
martin2020
Member



Posts : 521
Points : 1553
Join date : 2011-03-07

How do I make a dynamic array of pointers to an abstract class in C++? Empty
PostSubject: How do I make a dynamic array of pointers to an abstract class in C++?   How do I make a dynamic array of pointers to an abstract class in C++? Icon_minitimeThu Apr 07, 2011 4:15 am


I have an abstract class of animal.

There are subclasses rat, dog, and cat

I need a dynamic array to store a list of animals and their ages.

Do I go like this?

Rat r;
Dog d;
Cat c;

animal* animalsArray[3];
animalsArray[0]=&r;
animalsArray[1]=&d;
animalsArray[2]=&c;
++++++++++++++++++++++++++++
Minneapolis web design
Back to top Go down
 
How do I make a dynamic array of pointers to an abstract class in C++?
Back to top 
Page 1 of 1
 Similar topics
-
» Can anyone give me pointers on how to create a Maid of Honor speech?
» How do you make the "SF" sign with your hands?
» anyone on here make their own wine?
» How to make profit from Blogs?
»  How do I make a 3d pc game/ ipod app?

Permissions in this forum:You cannot reply to topics in this forum
 :: WarRock :: General Discussion-
Jump to: