comparing class syntax in C++, Java, PHP, Perl and Python

As I recently started learning Python one of the things I noticed which I didn’t like is the class syntax. So I wrote some minimal hello world programs in the languages I recently used to show the difference: C++ hello.cc #include <iostream> class Hello { private: char *value; public: Hello(char *newvalue) { value = newvalue; } void hello() { std::cout << this->value; } }; int main() { Hello hello("hello\n"); hello.hello(); } I like the C++ syntax, it is the language which introduced me to OOP and it clearly states what bits are what without too wordy syntax. ...

September 29, 2008 · 2 min · Christof Damian