C
c.ginestet
Hello,
I want to create classes that I could aggregate with each others using
operators. This would therefore take the form of a dynamic
aggregation.
For instance, (This code does not compile):
// Also include a base class MAMMAL for instance.
class cat
{
public:
cat();
~cat();
void meow();
protected:
int catAge;
}
void cat::meow();
{
std::cout << "Meow.";
}
class dog
{
public:
dog();
~dog();
void waouf();
protected:
int dogAge;
}
void dog::waouf();
{
std::cout << "Waouf.";
}
int main()
{
dog Bono;
cat Frisky;
mamal dogcat;
// Need to create an operator here,
dogcat = Bono + cat;
}
// And the resulting MAMMAL would have the following attributes and
// characteristic;
class dogcat
{
public:
dog();
~dog(); void waouf();
void waouf();
void meow();
protected:
int dogAge;
int catAge;
}
////////////////////////
Any help is welcome,
Thank you very much for your help,
Cedric
I want to create classes that I could aggregate with each others using
operators. This would therefore take the form of a dynamic
aggregation.
For instance, (This code does not compile):
// Also include a base class MAMMAL for instance.
class cat
{
public:
cat();
~cat();
void meow();
protected:
int catAge;
}
void cat::meow();
{
std::cout << "Meow.";
}
class dog
{
public:
dog();
~dog();
void waouf();
protected:
int dogAge;
}
void dog::waouf();
{
std::cout << "Waouf.";
}
int main()
{
dog Bono;
cat Frisky;
mamal dogcat;
// Need to create an operator here,
dogcat = Bono + cat;
}
// And the resulting MAMMAL would have the following attributes and
// characteristic;
class dogcat
{
public:
dog();
~dog(); void waouf();
void waouf();
void meow();
protected:
int dogAge;
int catAge;
}
////////////////////////
Any help is welcome,
Thank you very much for your help,
Cedric