Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as C++ by _sn ( 17 years ago )
#include <iostream>
#include <vector>
#include <string>
using namespace std;
//to jest klasa bazowa
class MeanOfTransport{
protected:
string temp;
public:
vector<MeanOfTransport*> children;
vector<MeanOfTransport*> objects;
string name;
string classname;
string brand;
string model;
int avarageprice;
MeanOfTransport(string cname, string rname, string tmodel="Reprezentant", string tbrand="Reprezentant", int tavarageprice=0):classname(cname), name(rname), model(tmodel), brand(tbrand),avarageprice(tavarageprice) {}
MeanOfTransport() {}
};
//i dalej..
class Motorist: public virtual MeanOfTransport{
public:
Motorist(string cname, string rname, string tmodel="Reprezentant", string tbrand="Reprezentant", int tavarageprice=0, int tmaxspeed=0): MeanOfTransport(cname, rname, tmodel, tbrand, tavarageprice), maxspeed(tmaxspeed) {}
Motorist() {}
int maxspeed;
};
//kolejne dziecko..
class Automobils: public Motorist{
public:
Automobils() {}
Automobils(string cname, string rname, string tmodel="Reprezentant", int tmaxspeed=0, string tbrand="Reprezentant", int tavarageprice=0):Motorist(cname, rname, tmodel, tbrand, tavarageprice, tmaxspeed){}
};
//next..
class With4wheels: public Automobils {
public:
With4wheels(string cname, string rname, string tmodel="Reprezentant", int tmaxspeed=0, string tbrand="Reprezentant", int tavarageprice=0, string ttype="Reprezentant"): Automobils(cname, rname, tmodel, tmaxspeed, tbrand, tavarageprice), type(ttype){}
string type;
With4wheels() {}
void Model(){
model="4 kołowy";
}
};
//na równi z automobils
class Air: public Motorist{
public:
Air() {}
Air(string cname, string rname, string tmodel="Reprezentant", string tbrand="Reprezentant", int tavarageprice=0, int tmaxspeed=0, int tceiling=0): Motorist(cname, rname, tmodel, tbrand, tavarageprice, tmaxspeed), ceiling(tceiling){}
int ceiling;
void Model(){
model="Powietrzny";
}
};
//dziecko air'a
class Plane: public Air{
public:
Plane(string cname, string rname, string tmodel="Reprezentant", string tbrand="Reprezentant", int tavarageprice=0,int tmaxspeed=0, int tceiling=0): Air(cname, rname, tmodel, tbrand, tavarageprice, tmaxspeed, tceiling){}
Plane() {}
Plane(int speed):Air("", "", "", NULL , NULL , speed, NULL){}
void Model(){
model="samolot";
}
};
// i zajebista amfibia. Przez to, że jest tutaj konstruktor do klas wyższych wywala się-> tzn pisze ze poszczegolne elementy klasy MeansOfTransport
//są ambiguous, czyli podwojone..
class Amfibia: public Plane, public With4wheels {
string temp;
public:
Amfibia(string cname, string rname, string tmodel="Brak modelu", int tmaxspeed=0, string tbrand="Brak marki", int tavarageprice=0, int tceiling=0, string ttype="brak typu"):
Plane(tmaxspeed),With4wheels()
{
this->Plane::classname = cname;
this->Plane::name = rname;
this->Plane::model = tmodel;
this->Plane::brand = tbrand;
//this->maxspeed = maxspeed;
this->avarageprice = tavarageprice;
this->ceiling = tceiling;
this->With4wheels::type = ttype;
}
};
int main() {
return 0;
}
Revise this Paste
Parent: 12392