// //HelloWorld.cpp //Copyright (c) 2014 TOSHIYUKI ARAI. ALL RIGHTS RESERVED. #include <oz++/CommonObject.h> #include <oz++/Exception.h> #include <oz++/CharString.h> #include <oz++/Locale.h> namespace OZ { class HelloWorld :public CommonObject { private: CharString string; public: HelloWorld(const char* message) :string(message) { } public: int compare(const char* name) { if (name== NULL) { throw IException("Invalid argument"); } return strcmp((const char*)string, name); } public: void display() { string.display(); } }; } int main(int argc, char** argv) { Locale locale; try { HelloWorld helloWorld("Hello world"); helloWorld.display(); helloWorld.compare(NULL); } catch (Exception& ex) { caught(ex); } return 0; } |