I have a class which declares a pointer to an String (aka Borland AnsiString).
The object ufo is OK, it is used everywhere.
no_dlls is a valid non const positive integer
If I assign passivedllpaths with new I get an exception.
Why can't I assign a pointer with new, to a pointer in a class object ?
class comps
{
public:
. . .
String* passivedllpaths ;
. . .
} ;
comps* ufo = new comps(..,..) ; //constructor takes args
//and at runtime
ufo->passivedllpaths = new String[no_dlls]; //get exception
If I declare passivedllpaths outside the class I don't get an exception
String* passivedllpaths ;
passivedllpaths = new String[no_dlls] ; //Is OK
TIA johnp
The object ufo is OK, it is used everywhere.
no_dlls is a valid non const positive integer
If I assign passivedllpaths with new I get an exception.
Why can't I assign a pointer with new, to a pointer in a class object ?
class comps
{
public:
. . .
String* passivedllpaths ;
. . .
} ;
comps* ufo = new comps(..,..) ; //constructor takes args
//and at runtime
ufo->passivedllpaths = new String[no_dlls]; //get exception
If I declare passivedllpaths outside the class I don't get an exception
String* passivedllpaths ;
passivedllpaths = new String[no_dlls] ; //Is OK
TIA johnp