Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Motore
- {
- public:
- Motore(int nPistoniI,int cilindrataI)
- {
- nPistoni=nPistoniI;
- cilindrata=cilindrataI;
- }
- ~Motore(){}
- private:
- int nPistoni;
- int cilindrata;
- };
- class Veicolo
- {
- public:
- Veicolo(string targaI,string nTelaioI,Motore *motoreI)
- {
- targa=targaI;
- nTelaio=nTelaioI;
- motore=motoreI;
- }
- ~Veicolo()
- {
- delete motore;
- }
- private:
- string targa;
- string nTelaio;
- Motore *motore;
- };
- int main()
- {
- Motore a(2,10);
- Motore *ptr=&a;
- Veicolo auto1("1234","boh",ptr);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement