Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class samochod{
- public:
- string nazwa_marki;
- double poj_silnika;
- int ilosc_osob;
- samochod(){}
- samochod(string nzw, double poj,int il)
- {
- nazwa_marki = nzw;
- poj_silnika = poj;
- ilosc_osob = il;
- }
- };
- ostream &operator<<(ostream &out, samochod u){
- out <<"marka: " << u.nazwa_marki << endl << "pojemnosc: " << u.poj_silnika << endl << "ilosc osob: " << u.ilosc_osob;
- return out;
- }
- int main()
- {
- samochod a();
- samochod b("Honda",2.1,3);
- cout << "samochod 0 argumentowy: " << endl;
- cout << a << endl;
- cout << endl;
- cout << "samochod 3 argumentowy: " << endl;
- cout << b << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement