Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <utility>
- using namespace std;
- class planer{
- private:
- public:
- char model[30];
- char konstr[30];
- int year;
- planer(char *b_model, char *b_konstr, int year){
- strcpy(model,b_model);
- strcpy(konstr, b_konstr);
- this->year = year;
- }
- };
- class plane : public planer{
- private:
- public:
- int speed;
- int km;
- plane(char *model, char *konstr, int year, int speed, int km) : planer(model, konstr, year) {
- this->speed = speed;
- this->km = km;
- }
- void print_plane(){
- cout << "Model: " << this->model << endl;
- cout << "Konstructor: " << this->konstr << endl;
- cout << "Year: " << this->year << endl;
- cout << "Speed: " << this->speed << endl;
- cout << "Km: " << this->km << endl;
- }
- };
- class rocket : public plane{
- public:
- char special[30];
- char fuel[30];
- rocket(char *model, char *konstr, int year, int speed, int km, char *b_special, char *b_fuel) : plane(model, konstr, year, speed, km) {
- strcpy(special, b_special);
- strcpy(fuel, b_fuel);
- }
- void print_all(){
- this->print_plane();
- cout << "Special: " << this->special << endl;
- cout << "Fuel: " << this->fuel << endl;
- }
- };
- int main() {
- auto bit = rocket("Bit", "Li", 2000, 1000, 320, "War", "Disel");
- bit.print_all();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement