Hello i got a little problem with my C++ project.
First of all i got the class:
class base
{
protected:
int R, G, B;
public:
base();
~base();
};
and the second class:
class superBase :
public base
{
public:
superBase(){R=0; G=0; B=0};
~superBase();
};
and the last class which contains the matrix of base class'es:
class gameTable : public gameGraphics
{
private:
base** table;
public:
gameTable();
~gameTable();
}
When i construct the gameTable class i construct 64 base objects with RANDOM R, G, B values from 0 to 255.
So when the programs goes on, some of mine elemntes in table 'evolves' and becomes superBase's. So here is my problem i don't know how to do that thing. I tried this,
which seems to not working properly.
superBase newBase;
table[column][row].~base();
table[column][row] = newBase;
and the other version:
table[column][row].~base();
table[column][row] = new superBase;
My question is how to evolve one element of the table to the superBase class element. As i know it can use the same pointer as base class element.
Greetings and thanks for help!