Calculator Step 3

- Main Page
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
node_unary Class Referenceabstract

`#include <node_impl.hpp>`

Inheritance diagram for node_unary:

## Public Member Functions
| node_unary (node operand)
node | operand () const
Public Member Functions inherited from node_impl
| node_impl ()
virtual | ~node_impl ()
void | print (std::ostream &stream, int indent) const
double | evaluate () const
std::string | to_string () const

## Protected Member Functions
double | evaluate_operand () const

## Private Member Functions
virtual void | print_node (std::ostream &stream, int indent) const override=0
virtual double | evaluate_node () const override=0

## Private Attributes
node | operand_

## Detailed Description

Abstract base class for unary operators.

Definition at line 98 of file node_impl.hpp.

## Constructor & Destructor Documentation

node_unary::node_unary | ( | node | operand | ) |

Definition at line 162 of file node_impl.cpp.

163 : node_impl{}, operand_{operand}
164 {}
node_impl
Definition: node_impl.hpp:17
node_unary::operand_
node operand_
Definition: node_impl.hpp:108

## Member Function Documentation

virtual double node_unary::evaluate_node | ( |  | ) | const
| override private pure virtual

Implements node_impl.

Implemented in node_negate.

double node_unary::evaluate_operand | ( |  | ) | const
| protected

Definition at line 172 of file node_impl.cpp.

References node::evaluate(), and operand().

Referenced by node_negate::evaluate_node().

174 {
175 return operand().evaluate();
176 }
node::evaluate
double evaluate() const
Definition: node.cpp:50
node_unary::operand
node operand() const
Definition: node_impl.cpp:166

node node_unary::operand | ( |  | ) | const

Definition at line 166 of file node_impl.cpp.

References operand_.

Referenced by evaluate_operand(), and node_negate::print_node().

168 {
169 return operand_;
170 }
node_unary::operand_
node operand_
Definition: node_impl.hpp:108

virtual void node_unary::print_node | ( | std::ostream & | stream,
|  | int | indent
| ) |  | const
| override private pure virtual

Implements node_impl.

Implemented in node_negate.

## Member Data Documentation

node node_unary::operand_
| private

Definition at line 108 of file node_impl.hpp.

Referenced by operand().

The documentation for this class was generated from the following files:

- node_impl.hpp
- node_impl.cpp