J
James
Hi, I'm hoping someone can help me out.
If I declare a class, eg.
class CSomeclass
{
public:
var/func etc.....
private
varfunc etc..
};
Then in the code I create a pointer to this class definition
CSomeClass *MyClass;
I want to be able to dynamically increase the size of the
class as I go. Imagine I have a current count of the
object - eg. Count. Whenever I try to allocate
memory for it,
Count++;
MyClass[Count] = new SomeClass;
But it throws an error:
error C2679: binary '=' : no operator found which takes
a right-hand operand of type 'CAlien *'
(or there is no acceptable conversion)
I have no idea how many instances I am going to need ahead of time,
and I can't find and combination of the line that allows it to work.
If anyone has any advicce on what I'm doing wrong it would be much
apreciated. Thank you.
James Alger
If I declare a class, eg.
class CSomeclass
{
public:
var/func etc.....
private
varfunc etc..
};
Then in the code I create a pointer to this class definition
CSomeClass *MyClass;
I want to be able to dynamically increase the size of the
class as I go. Imagine I have a current count of the
object - eg. Count. Whenever I try to allocate
memory for it,
Count++;
MyClass[Count] = new SomeClass;
But it throws an error:
error C2679: binary '=' : no operator found which takes
a right-hand operand of type 'CAlien *'
(or there is no acceptable conversion)
I have no idea how many instances I am going to need ahead of time,
and I can't find and combination of the line that allows it to work.
If anyone has any advicce on what I'm doing wrong it would be much
apreciated. Thank you.
James Alger