-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOperator.cpp
More file actions
43 lines (32 loc) · 764 Bytes
/
Copy pathOperator.cpp
File metadata and controls
43 lines (32 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "Operator.h"
#include "Operation.h"
#include <iostream>
std::string Operator::WhatAmI() const {
return "Operator" ;
}
//Constructor
Operator::Operator(){
oper_ = new Operation() ;
second_next_ = nullptr ; //initialization of the next node on the null pointer
}
Operator::Operator(Operation *op){
oper_ = op ;
second_next_ = nullptr ; //initialization of the next node on the null pointer
}
//Destructor
Operator::~Operator(){
delete oper_ ;
}
//Getters
Operation* Operator::oper() const {
return oper_ ;
}
Node* Operator::second_next() const {
return second_next_ ;
}
void Operator::set_second_next(Node* newval){
second_next_ = newval;
}
std::string Operator::print() const {
return "Operator" + oper_->operation() ;
}