stack.hpp

来自「financal instrument pricing using c」· HPP 代码 · 共 47 行

HPP
47
字号
// Stack.hpp
//
// (C) Datasim Education BV 1999

#ifndef STACK_HPP
#define STACK_HPP


class StackState;

class Stack
{
private:
	StackState* sst;		// State of the stack
	double * Elements;		// Elements of the stack
	long Size;				// Maximum size of the stack
	long Current;			

	Stack(const Stack& source);			// Copy constructor
	// Operators
	Stack& operator = (const Stack& source);

protected:
	// The next functions will be used by the StackState base class
	void ChangeState(StackState* NewState);
	friend class StackState;

	
	void private_push(double element);
	double private_pop();
	int getmaxelements();
	int getcurrentindex();

public:
	// Constructors & destructor
	Stack();							// Default constructor
	Stack(int NewSize);					// Initial size of the stack

	virtual ~Stack();					// Destructor

	void Push(double NewItem);			// Push an element on the stack 
	double Pop();						// Pop the last pushed element of the stack


};

#endif // STACK_HPP

⌨️ 快捷键说明

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