⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shapedecorator.cpp

📁 financal instrument pricing using c
💻 CPP
字号:
// ShapeDecorator.hpp
//
// Base class for shape decorators
//
// 5 november 1998	RD	Started
//
// (C) Datasim Education BV 1998

#include "ShapeDecorator.hpp"

ShapeDecorator::ShapeDecorator(): Shape()
{ // Default constructor

	shape=NULL;
}

ShapeDecorator::ShapeDecorator(const Shape& s): Shape(s)
{ // Normal constructor

	shape=s.Clone();
}

ShapeDecorator::ShapeDecorator(const ShapeDecorator& source): Shape(source)
{	// Copy constructor

	shape=source.shape->Clone();
}

ShapeDecorator::~ShapeDecorator()
{ // Destructor

	// Delete the contained shape
	if (shape!=NULL) delete shape;
}

Shape* ShapeDecorator::getShape() const
{ // Return the shape pointer

	return shape;
}

// Operators
ShapeDecorator& ShapeDecorator::operator = (const ShapeDecorator& source)
{ // Assignment operator

	// Exit if same object
	if (this==&source) return *this;

	// Call base assignment
	Shape::operator = (source);

	shape=source.shape->Clone();

	return *this;
}

⌨️ 快捷键说明

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