1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
#include <iostream>
#include <string>
using namespace std;
class GeneralSpec
{
private:
string Manufacturer;
string Model;
string ProType;
int Year;
int Weight;
public:
void SetSpec(string a, string b, string c, int d, int e);
string GetSpec();
};
class GeneralInfo
{
private:
int RegNum;
string Serial;
string Owner;
public:
void SetInfo(int f, string g, string h);
string GetInfo();
};
class Computer
{
private:
public:
GeneralInfo Info;
GeneralSpec Spec;
Computer();
~Computer();
};
string GeneralInfo::GetInfo()
{
return RegNum, Serial, Owner;
}
void GeneralInfo::SetInfo(int f, string g, string h)
{
RegNum = f;
Serial = g;
Owner = h;
}
string GeneralSpec::GetSpec()
{
return Manufacturer, Model, ProType, Year, Weight;
}
void GeneralSpec::SetSpec(string a, string b, string c, int d, int e)
{
Manufacturer = a;
Model = b;
ProType = c;
Year = d;
Weight = e;
}
int main()
{
Computer PC1;
Computer PC2;
PC1.Info.SetInfo(545565, "GH554H451I", "George");
PC1.Spec.SetSpec("HP", "GP7000", "AMD", 2013, 3);
return 0;
}
|