(ref.doc)subobjects
Next ass-in-mbr-init
Up: cppR 5/3
C++ Report
March/April 93 - Vol 5/No 3
p 51
Subobject members, by Stephen Dewhurst
- "natural" and "synthetic" inheritance relationships
- subobject member: a member that reroutes messages to its containing
object in the same way that subobjects (base classes) allow
customization of their response to messages by their complete object
(most derived class)
- #define C_addr(C, M) ((C*)(((char*)this)-offsetof(C, M)))
If code size, compile time, and build complexity are not important,
a template function may be used in place of the macro.
- class Engine {
// ...
public:
void start();
void stop();
private:
EngineCustom _env;
friend class EngineCustom;
};
Here we have defined a member for customization, a "hook", to be
defined by the environment in which Engine is compiled.
automatically generated by info2www version 1.2.2.8