shapevisitor.cpp

来自「financal instrument pricing using c」· C++ 代码 · 共 51 行

CPP
51
字号
// ShapeVisitor.cpp
//
// Base class for all shape visitors
//
// 16 september 1998	RD	Started

// (C) Datasim Education BV 1998

#include "ShapeVisitor.hpp"

// Constructors and Destructor
ShapeVisitor::ShapeVisitor()
{ // Default constructor
}

ShapeVisitor::ShapeVisitor(const ShapeVisitor& source)
{ // Copy constructor
}

ShapeVisitor::~ShapeVisitor()
{ // Destructor
}


void ShapeVisitor::Visit(ShapeComposite& sc)
{ // Visit shape composite
  // Override in subclasses to add extra behaviour

	ShapeComposite::iterator it;

	// Send all shapes in the composite to the visitor
	for (it=sc.Begin(); it!=sc.End(); it++)
	{
		(*it)->Accept(*this);
	}
}

void ShapeVisitor::Visit(NameDecorator& nd)
{ // Visit NameDecorator

	nd.GetShape()->Accept(*this);
}


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

	return *this;
}

⌨️ 快捷键说明

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