I am working with simple classes. When setting a class for an animal I use this code:
So basically this creates a new animal class by the name of someName. Here's my problem: What do I do if I want the class name to be a variable? For example I want to be able to make a few animal classes, and each class name would be going up by 1.Code:animal someName; someName.info();
(animals1, animals2, animals3)
to do this the name would have to be a variable. I tried creating a new class by using a pointer but it did not work. If anyone can shed some light on this it would be apreciated.