Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- class Samochod
- {
- public:
- int wiek;
- string imie;
- void wypisz()
- {
- cout<<"wiek"<<wiek<<"imie"<<imie<<endl;
- }
- Samochod(int wiek, string imie)
- {
- this->wiek=wiek;
- this->imie=imie;
- }
- ~Samochod();
- };
- int main()
- {
- Samochod nowy(21,"szybki");
- nowy.wypisz(); // i tak nie dziala;
- Samochod *nowy= new Samochod(21, "szybki");
- nowy->wypisz(); // a tak dziaa
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement