Initialize an array of classes?
- From: "Bob Altman" <rda@xxxxxxxxxxxxx>
- Date: Wed, 30 Jul 2008 11:34:50 -0700
Hi all,
I have a class that contains a member variable that is an array of class
instances:
class MyClass {
private:
SomeClass m_someClass;
SomeClass m_arrayOfClasses[2];
};
Now, the SomeClass class doesn't have a default (paramterless) constructor,
so I need to call its constructor in my initialization list of the MyClass
constructor, kind of like this:
// Constructor
MyClass::MyClass(void) :
// This compiles ok
m_someClass( constructor_arguments ),
// This doesn't compile
m_arrayOfClasses[0]( constructor_arguments ),
m_arrayOfClasses[1]( constructor_arguments )
{}
How do I initialize the array of class instances?
TIA - Bob
.
- Follow-Ups:
- Re: Initialize an array of classes?
- From: David Wilkinson
- Re: Initialize an array of classes?
- From: Bob Altman
- Re: Initialize an array of classes?
- Prev by Date: Re: Compiler Intrinsics for "__asm pause"
- Next by Date: Re: C++/CLI: Explicit interface property implementation
- Previous by thread: Memory stream for bitmap
- Next by thread: Re: Initialize an array of classes?
- Index(es):
Relevant Pages
|