newbie question

I've declared a new class object within a struct. I am not allowed to initialize the new object . Can anyone help. Here is what I'm trying to do.

template <class type>
class BigClass
{
private:
type* item;

public:
BigClass(int = 100);
~BigClass();

};


template <class type>
BigClass<type>::BigClass(int size)
{
item = new type[size];
}

template <class type>
BigClass<type>::~BigClass()
{
delete [] item;
}


#include <stdlib.h>
#include "BigClass.h"

#include <string>

using namespace std;

struct StTwo
{
int a;
};

struct StOne
{
string b;
BigClass<StTwo> obj(5);
};
void main()
{
StOne New1;

}


I get this error:

-------Configuration: tester - Win32 Debug-------
Compiling...
tester.cpp
C:\VCppProj\tester.cpp(19) : error C2059: syntax error : 'constant'
Error executing cl.exe.


How can I initialize the class object. I didnt think I would get an error trying to initialize.:wave:
[1234 byte] By [spectator] at [2007-11-19 1:36:48]
# 1 Re: newbie question
Consider this:
struct StOne
{
StOne()
: obj(5)
{

}

string b;
BigClass <StTwo> obj;
};Good Luck
gradiov at 2007-11-11 0:51:09 >