• 大小: 2KB
    文件类型: .cpp
    金币: 1
    下载: 0 次
    发布日期: 2021-06-04
  • 语言: C/C++
  • 标签: UserApp.cpp  

资源简介

Package-delivery services, such as FedEx®, DHL® and UPS®, offer a number of different shipping options, each with specific costs associated. Create an inheritance hierarchy to represent various types of packages.

资源截图

代码片段和文件信息

#include
#include
using namespace std;
class Shape
{
public :
virtual void draw(){
cout<<“drow Shape!“< }
};
class Point
{
public:
double x;
double y;
};
class Triangle:public Shape
{
public:
Point a;
Point b;
Point c;
void draw(){
cout<<“Triangle!“< cout<<“(“< cout<<“(“< cout<<“(“<};
class Square:public Shape
{
public:
Point v1;
double width;
void draw(){
cout<<“Square!“< };
};
class Rectangle:public Shape
{
public:
Point a;
Point b;
double width;
double height;
void draw(){
cout<<“Rectangle!“< };
};
class Graphics:public Shape
{
public :
vector shapes;
void add(Shape *shape){
shapes.push_back(shape);
};
void draw(){
for(int i=0;i {
Shape *shape=shapes[i];
shape-

评论

共有 条评论

相关资源