Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class samochod{
- public:
- string marka;
- int pojemnosc;
- int ilosc_osob;
- samochod(){
- cout << "Konstruktor 0 arg." << endl;
- }
- samochod(string m, int v, int io){
- marka = m;
- pojemnosc = v;
- ilosc_osob = io;
- cout << "Konstruktor 3 arg." << endl;
- }
- };
- ostream &operator<<(ostream &out, samochod &smd){
- out << "Marka: " << smd.marka << " | Pojemnosc: " << smd.pojemnosc << "cm^3 | Ilosc: " << smd.ilosc_osob << "\n";
- return out;
- }
- int main()
- {
- samochod s1("Audi", 2000, 5);
- samochod s2;
- s2.marka = "BMW";
- s2.pojemnosc = 2500;
- s2.ilosc_osob = 5;
- cout << endl;
- cout << s1;
- cout << s2;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement