Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Project5.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
- //
- #include "pch.h"
- #include <iostream>
- #include <string>
- using namespace std;
- class Point { //базовый класс
- public:
- int x;
- int y;
- void Show(string info)
- {
- cout « "Point" « info « ": (" « x « "," « y « ")" « endl;
- }
- };
- class PointSpace : public Point //производный класс
- {
- public:
- int z;
- void Show(string info)
- {
- cout « "Point" « info « ": (" « x « "," « y « "," « z « ")" « endl;
- }
- };
- int main()
- {
- Point pointA;
- pointA.x = 0;
- pointA.y = 0;
- pointA.Show("A");
- PointSpace pointB;
- pointB.x = 1;
- pointB.y = 1;
- pointB.z = 1;
- pointB.Show("B");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement