ex5-2-1.cpp

来自「一些学习c++的例题」· C++ 代码 · 共 39 行

CPP
39
字号
#include <iostream.h>

struct Point { float x, y; };

class Quadrangle
{
public:
   Point Points[4];

public:
   void Print() { cout << "I'm Quadrangle\n"; }
};

class Rectangle : public Quadrangle
{
public:
   void Print() { cout << "I'm Rectangle.\n"; }
};

class Diamond : public Quadrangle
{
public:
   void Print() { cout << "I'm Diamond.\n"; }
};

class Square : public Rectangle, public Diamond
{
public:
   void Print() { cout << "I'm Square.\n"; }
};

void main()
{
   Square s;

   s.Points[0].x = 10.0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?