Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Expression
- {
- public:
- virtual double eval() = 0;
- };
- class FE: public Expression
- {
- public:
- FE * expr = nullptr;
- FE(FE* expr1) : expr(expr1) { }
- double eval()
- {
- return 1;
- }
- ~FE()
- {
- delete expr;
- }
- };
- int main()
- {
- FE * expr = new FE(nullptr);
- {
- for (int i = 0; i < 5000; i++)
- {
- expr = new FE(expr);
- }
- }
- delete expr;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement