felixhao28 / JSCPP

A simple C++ interpreter written in JavaScript

Home Page:https://felixhao28.github.io/JSCPP/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot use the OOP feature of Cpp

onion108 opened this issue · comments

My code run well on my local compiler but can't run normally on JSCPP.
Source Code:

#include <iostream>
using namespace std;

class Main {
    public:
    Main() {
        cout << "Program Started.";
    }
    int run() {
        cout << "Hello, World!" << endl;
        return 0;
    }
    ~Main() {
        cout << "Program Exited.";
    }
};


int main() {
    Main mainProgram;
    return mainProgram.run();
}

And that's what JSCPP says:

Error: ERROR: Parsing Failure:
line 4 (column 12): ce std;\n\nclass Main {\n    public:\n    Ma
------------------------------------------^
Expected "(", ",", "/*", "//", ";", "=", "[" or [ \n\r\t\u000B\u000C] but "{" found.

Most object-oriented features are not implemented yet.