#include // Declare the class class octave_hello : public octave_base_value { public: octave_hello (); ~octave_hello(); private: DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA }; // Define methods DEFINE_OCTAVE_ALLOCATOR (octave_hello); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_hello, "octave_hello", "octave_hello"); octave_hello::octave_hello () { octave_stdout << "Hello!" << std::endl; } octave_hello::~octave_hello () { octave_stdout << "good bye!" << std::endl; } // Interface DEFUN_DLD(hello_obj, args, , "obj = hello_obj () \n\tReturn an octave_hello class object") { static bool type_loaded; octave_value retval; if (!type_loaded) { octave_hello::register_type(); type_loaded = true; octave_stdout << "octave_hello installed at type-id = " << octave_hello::static_type_id () << "\n"; } retval = octave_value (new octave_hello ()); return retval; }