libAnyBus/Defining_a_new_class
This tutorial describes how to define a class that can be used on the bus.
Consider the following class:
1 2 3 4 5 | class C { int i; C ( int i ) : i ( i ) {}; }; |
This class must adhere to the following rules:
The class must be derived from anybus::Object
The class must have a default (no parameters) constructor (there is ways to get around this, but let's keep it simple).
The class must have a method called type that returns the class' corresponding anybus::Type object. Consider the following:
cpp
C ( int i = 0 ) : i ( i ) {};
};
This satisfies the first two rules:
- The class is now derived from anybus::Object,
- and the constructor can be called without parameters.
Comments (0)
Post comment
If you wish, you can use markdown syntax in the comment field.