Calculator Step 3

- Main Page
- Classes
- Files

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

Public Member Functions | Private Member Functions | List of all members
node_negate Class Reference

`#include <node_impl.hpp>`

Inheritance diagram for node_negate:

## Public Member Functions
| node_negate (node operand)
Public Member Functions inherited from node_unary
| 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

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

## Additional Inherited Members
Protected Member Functions inherited from node_unary
double | evaluate_operand () const

## Detailed Description

Unary negation.

Definition at line 129 of file node_impl.hpp.

## Constructor & Destructor Documentation

node_negate::node_negate | ( | node | operand | ) |

Definition at line 207 of file node_impl.cpp.

208 : node_unary{operand}
209 {}
node_unary
Definition: node_impl.hpp:98

## Member Function Documentation

double node_negate::evaluate_node | ( |  | ) | const
| override private virtual

Implements node_unary.

Definition at line 218 of file node_impl.cpp.

References node_unary::evaluate_operand().

220 {
221 return -evaluate_operand();
222 }
node_unary::evaluate_operand
double evaluate_operand() const
Definition: node_impl.cpp:172

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

Implements node_unary.

Definition at line 211 of file node_impl.cpp.

References node_unary::operand(), and node::print().

213 {
214 stream << std::setw(indent) << "" << "-\n";
215 operand().print(stream, indent + 2);
216 }
node::print
void print(std::ostream &stream, int indent=0) const
Definition: node.cpp:44
node_unary::operand
node operand() const
Definition: node_impl.cpp:166

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

- node_impl.hpp
- node_impl.cpp