C++ or Java?
Author
Zhou Renjian
Create@
2006-09-08 16:13
#define Package(x)
#define Import(x)
#define Extends : public
#define Private private:
#define Public public:
#define Protected protected:
#define This(x) x
#define Super(x) x
Package(org.eclipse.swt);
Import(org.eclipse.swt.wigets.*);
class Composite {
};
class Button Extends Composite {
Private int x,y;
Public Button() {
This(x) = 32;
This(y) = 4;
};
Public void press() {
This(y) += 4;
};
Protected void beep() {
This(x) += 234;
};
};
class OKButton Extends Button {
Private int type;
Public OKButton() {
This(type) = 2;
};
Public void press() {
This(type) = 1;
Super(beep());
};
};
int main() {
OKButton btn;
btn.press();
return 0;
}
/*
Try to write C++ in Java-like grammer? Is it possible? But Java to C++ converter makes nonsense.
*/