class Base{
public:
int x;
int y;
};
class
class Base{
public:
int x;
int y;
};
class
Code tags? Proper grammar?
Code:class base { public: int x, y, z; double whocares; } my_array[200]; //creates an array of too bases /******* OR *******/ class base { public: int x, y, z; double whocares; }; base my_array[200]; /******* OR *******/ class base { public: int x, y, z; double whocares; }; typedef base array[200]; array my_array;
class BASE{
public:
int x;
int y;
int c;
void print(void){cout<<"base";}
};
class CHILD1 : public BASE{
void print(void){cout<<"child1";}
};
class CHILD2 : public BASE{
void print(void){cout<<"child2";}
}
How to make array
that CHILD1 and CHILD2 both objects are in it?
int main(int argc, char* argv[]){
BASE * base[2];
base[0]=new CHILD1;
base[1]=new CHILD2;
base[0].print();
base[1].print();
return 0;
}
it gives
base base
but I want
child1 child2
how to make it work?
sry
I pushed the button too early
Threads have been merged