Create a class Lab which will have the objects from the class Computer which will further carries the object of another class named Accessories
Write required methods and attributes with in the class implementation.
Using the knowledge from above relationships complete your implementation.
#include <iostream>
using namespace std;
class Accessories{
private:
int acc_id;
string acc_name;
public:
void setAccID(int i){
acc_id=i;
}
void setAccName(string n){
acc_name=n;
}
int getAccID(){
return acc_id;
}
string getAccName(){
return acc_name;
}
};
class Computer{
public:
Accessories a;
};
class Lab{
public:
Computer c;
};
int main()
{
Accessories a1;
Computer c1;
Lab l1;
return 0;
}
Comments
Leave a comment