I want to write a c++1z program based on Java code
First an interface is declared in Java.
public interface MyExpression {
  public boolean interpret();
}
An abstract class in java that implements the interface
public abstract class NonTerminal implements MyExpression {
  protected MyExpression left, right;
  public void setLeft(MyExpression left) {
    this.left = left;
  }
  public void setRight(MyExpression right) {
    this.right = right;
  }
}
and finally the class
public class Or extends NonTerminal {
  public boolean interpret() {
    return left.interpret() || right.interpret();
  }
  public String toString() {
    return String.format("(%s | %s)", left, right);
  }
}
How do I create this functionality in modern c++?
update c++ snippet
#include <iostream>
#include <memory>
#include <ostream>
class BooleanExpression {
public:
    virtual ~BooleanExpression() = default;
    virtual bool interpret() = 0;
};
class NonTerminal : public BooleanExpression {
protected:
    std::unique_ptr<BooleanExpression> left, right;
public:
    void setLeft(std::unique_ptr<BooleanExpression>&& left) {
        this->left = std::move(left);
    }
    void setRight(std::unique_ptr<BooleanExpression>&& right) {
        this->right = std::move(right);
    }
};
class Terminal : public BooleanExpression {
protected:
    bool value;
public:
    Terminal(bool value) : value(value) {}
    //tostring
};
class False : public Terminal {
public:
    False() : Terminal(false) {}
    //tostring
};
class True : public Terminal {
public:
    True() : Terminal(true) {}
    //tostring
};
class Or : public NonTerminal {
public:
    bool interpret() {
        return left->interpret() || right->interpret();
    }
};
class And : public NonTerminal {
public:
    bool interpret() {
        return left->interpret() && right->interpret();
    }
    //tostring
};
int main() {
    using namespace std;
    auto  t1 = make_unique<True>();
    auto f1 = make_unique<False>();
    auto or1 = make_unique<Or>();
    or1->setLeft(t1);
    return 0;
}
This code does not compile. or1->setLeft does not accept t1, ie make_unique().
 
     
    