M
Michael Bell
I have been going through the textbooks, and they all seem to dodge
what I see as a necessary question: How do you create multiple
instances of the same class?
The problem is that these are teaching books and they only
create one instance, and that is a special case, in real
life you will want to create lots of instances.
Lets's take a simple class declaration
class ClassName
{
struct:
int i;
char c;
bool b;
//etc
};
That creates the class ClassName. Now I can declare an instance of it
like this:-
ClassName InstanceName;
How do I declare more instances?
ClassName InstanceName1;
ClassName InstanceName2;
ClassName InstanceName3;
// etc
Michael Bell
--
what I see as a necessary question: How do you create multiple
instances of the same class?
The problem is that these are teaching books and they only
create one instance, and that is a special case, in real
life you will want to create lots of instances.
Lets's take a simple class declaration
class ClassName
{
struct:
int i;
char c;
bool b;
//etc
};
That creates the class ClassName. Now I can declare an instance of it
like this:-
ClassName InstanceName;
How do I declare more instances?
ClassName InstanceName1;
ClassName InstanceName2;
ClassName InstanceName3;
// etc
Michael Bell
--