Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- const int ILOSC = 6;
- class Pociag {
- friend class Pociag_os;
- friend class Pociag_tow;
- private:
- string nazwa;
- string kolor;
- int wagony;
- public:
- Pociag() {
- nazwa = "pociag1";
- kolor = "kolor1";
- wagony = 5;
- }
- Pociag(string nazwa, string kolor, int wagony) {
- this->nazwa = nazwa;
- this->kolor = kolor;
- this->wagony = wagony;
- }
- string nazwa_return() {
- return nazwa;
- }
- string kolor_return() {
- return kolor;
- }
- int wagony_return() {
- return wagony;
- }
- void pokaz_opis() {
- cout << "Dane Pociagu:\n";
- // do zrobienia
- }
- };
- class Pociag_os : public Pociag {
- private:
- int liczba_miejsc;
- public:
- Pociag_os(){
- }
- Pociag_os(string nazwa, string kolor, int wagony, int liczba_miejsc) {
- this->nazwa = nazwa;
- this->kolor = kolor;
- this->wagony = wagony;
- this->liczba_miejsc = liczba_miejsc;
- }
- int miejsca_return() {
- return liczba_miejsc;
- }
- };
- class Pociag_tow : public Pociag {
- private:
- int ladownosc;
- public:
- Pociag_tow() {
- }
- Pociag_tow(string nazwa, string kolor, int wagony, int miejsca) {
- this->nazwa = nazwa;
- this->kolor = kolor;
- this->wagony = wagony;
- this->ladownosc = ladownosc;
- }
- int ladownosc_return() {
- return ladownosc;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement