-
December 27th, 2003, 08:44 PM
#1
initialize a class with array member data
Given the below snippet from a class:
//////////////////////////////////////////////////
class safearray
{
private:
static const int LIMIT = 10;
int array[LIMIT];
public:
safearray()
{ }
//////////////////////////////////////////////////
Is there any way to use a constructor to setup array[] so that the item at index n is zero (or any other int)? I know how to set it up for other types - ie:
classname() : int(0)
{ }
or
classname(int a) : int(a)
{ }
but I'm not having any luck doing this for arrays.
Thanks for any help.
Matt
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|