opC++ Features

opC++ Compiler

opC++ Language

opGames Company

Opclass

opclass

Overview:

opclass is a new category in the Standard opC++ Dialect.

opclass has these characteristics:

  • polymorphic (has a virtual function table)
  • reflection support
  • fast casting support

Syntax:

opclass has the syntax of a c++ class, with a few additions.


opclass classname : parentname
{
...class members...
}

Restrictions:

  • opclass only allows single inheritance.
  • using macros in an opclass requires a c++ {} block.
  • you may not use macros in the initial declaration.
  • conditional directives (#if) must pair up within or outside the opclass, no splitting brace blocks.

Multiple Inheritance

opclass disallows multiple inheritance so it can know unambigiously what its parent is.

However, you can get multiple inheritance if you need it by using parameterized inheritance.

There is still a restriction though that you must inherit from one opclass when doing this, though you can add as many C++ classes as you like.


template<class opParent, class cppParent >
class multiple : public opParent, public cppParent
{};

opclass example : public multiple< opcppClass, cppClass >
{
    ...
};

Macros

Preprocessor macros must go inside c++ brace blocks. The use of #defines is discouraged, use opmacro instead if possible.


opclass example
{
    c++
    {
        MACRO(blah)
    }
}

Conditional Compiling

Conditional compilation applies to all generated code as well as what you'd expect.

The only restriction is that you match up conditions without splitting up brace blocks. This is generally not a good idea in C++ anyways.

Example of what's not allowed:


#if DEBUG
opclass exampledebug
{
#else
opclass example
{
#endif

    ...
}

Recent Changes (All) | Edit SideBar Page last modified on December 01, 2007, at 02:53 PM Edit Page | Page History
Copyright 2010 opGames Inc.