3.1.1 Hello world

 On OZ++ application you simply include OZ++ class header files as your needs, as shown below. You also have to write your own main function of the C/C++ program entry point.



//
//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;
}



Last modified: 29 Aug 2016

 Last modified: 29 Aug2016

Copyright (c) 2000-2016 Antillia.com ALL RIGHTS RESERVED.