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_binary Class Referenceabstract

`#include <node_impl.hpp>`

Inheritance diagram for node_binary:

## Public Member Functions
| node_binary (node left, node right)
node | left () const
node | right () 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_left () const
double | evaluate_right () 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 | left_
node | right_

## Detailed Description

Abstract base class for binary operators.

Definition at line 112 of file node_impl.hpp.

## Constructor & Destructor Documentation

node_binary::node_binary | ( | node | left,
|  | node | right
| ) |  |

Definition at line 178 of file node_impl.cpp.

179 : node_impl{}, left_{left}, right_{right}
180 {}
node_binary::left_
node left_
Definition: node_impl.hpp:124
node_impl
Definition: node_impl.hpp:17
node_binary::right_
node right_
Definition: node_impl.hpp:125

## Member Function Documentation

double node_binary::evaluate_left | ( |  | ) | const
| protected

Definition at line 194 of file node_impl.cpp.

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

Referenced by node_add::evaluate_node(), node_subtract::evaluate_node(), node_multiply::evaluate_node(), and node_divide::evaluate_node().

196 {
197 return left().evaluate();
198 }
node::evaluate
double evaluate() const
Definition: node.cpp:50
node_binary::left
node left() const
Definition: node_impl.cpp:182

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

Implements node_impl.

Implemented in node_divide, node_multiply, node_subtract, and node_add.

double node_binary::evaluate_right | ( |  | ) | const
| protected

Definition at line 200 of file node_impl.cpp.

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

Referenced by node_add::evaluate_node(), node_subtract::evaluate_node(), node_multiply::evaluate_node(), and node_divide::evaluate_node().

202 {
203 return right().evaluate();
204 }
node_binary::right
node right() const
Definition: node_impl.cpp:188
node::evaluate
double evaluate() const
Definition: node.cpp:50

node node_binary::left | ( |  | ) | const

Definition at line 182 of file node_impl.cpp.

References left_.

Referenced by evaluate_left(), node_add::node_add(), node_divide::node_divide(), node_multiply::node_multiply(), node_subtract::node_subtract(), node_add::print_node(), node_subtract::print_node(), node_multiply::print_node(), and node_divide::print_node().

184 {
185 return left_;
186 }
node_binary::left_
node left_
Definition: node_impl.hpp:124

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

Implements node_impl.

Implemented in node_divide, node_multiply, node_subtract, and node_add.

node node_binary::right | ( |  | ) | const

Definition at line 188 of file node_impl.cpp.

References right_.

Referenced by evaluate_right(), node_add::print_node(), node_subtract::print_node(), node_multiply::print_node(), and node_divide::print_node().

190 {
191 return right_;
192 }
node_binary::right_
node right_
Definition: node_impl.hpp:125

## Member Data Documentation

node node_binary::left_
| private

Definition at line 124 of file node_impl.hpp.

Referenced by left().

node node_binary::right_
| private

Definition at line 125 of file node_impl.hpp.

Referenced by right().

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

- node_impl.hpp
- node_impl.cpp