What should be the relationship between class ABC and KLM ? Whether it should be composition, aggregation or association or any other relationship.
#include<iostream>
using namespace std;
class ABC
{
int x;
public:
ABC() { cout<<"1\t"; }
~ABC() { cout<<"2\t"; }
};
class KLM
{
int y;
ABC *O1;
public:
KLM() { cout<<"3\t"; }
~KLM() { cout<<"4\t"; }
};
int main()
{
KLM *O4=new KLM();
ABC a1;
delete(O4);
return 0;
}
Aucun commentaire:
Enregistrer un commentaire