Calculator  Step 4
Public Member Functions | Private Member Functions | List of all members
node_subtract Class Reference

#include <node_impl.hpp>

Inheritance diagram for node_subtract:
node_binary node_impl

Public Member Functions

 node_subtract (node left, node right)
 
- Public Member Functions inherited from node_binary
 node_binary (node left, node right)
 
node left () const
 
node right () const
 
- Public Member Functions inherited from node_impl
 node_impl ()
 
 node_impl (node_impl &&)=default
 
node_imploperator= (node_impl &&)=default
 
virtual ~node_impl ()
 
void print (std::ostream &stream, int indent) const
 
double evaluate () const
 
std::string to_string () const
 
identifier_list const & get_parameters () 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_binary
double evaluate_left () const
 
double evaluate_right () const
 

Detailed Description

Subtraction.

Definition at line 164 of file node_impl.hpp.

Constructor & Destructor Documentation

node_subtract::node_subtract ( node  left,
node  right 
)

Definition at line 316 of file node_impl.cpp.

317 : node_binary(left, right)
318 {}
node_binary(node left, node right)
Definition: node_impl.cpp:250

Member Function Documentation

double node_subtract::evaluate_node ( ) const
overrideprivatevirtual

Implements node_binary.

Definition at line 328 of file node_impl.cpp.

References node_binary::evaluate_left(), and node_binary::evaluate_right().

330 {
331  return evaluate_left() - evaluate_right();
332 }
double evaluate_right() const
Definition: node_impl.cpp:272
double evaluate_left() const
Definition: node_impl.cpp:266
void node_subtract::print_node ( std::ostream &  stream,
int  indent 
) const
overrideprivatevirtual

Implements node_binary.

Definition at line 320 of file node_impl.cpp.

References node_binary::left(), node::print(), and node_binary::right().

322 {
323  stream << std::setw(indent) << "" << "-\n";
324  left().print(stream, indent + 2);
325  right().print(stream, indent + 2);
326 }
node right() const
Definition: node_impl.cpp:260
void print(std::ostream &stream, int indent=0) const
Definition: node.cpp:51
node left() const
Definition: node_impl.cpp:254

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