File:  [parser3project] / parser3 / src / doc / ClassExample3.dox
Revision 1.4.34.1: download - view: text, annotated - select for diffs - revision graph
Mon Mar 29 07:25:52 2004 UTC (22 years, 3 months ago) by paf
Branches: release_3_1_2
Diff to: branchpoint 1.4: preferred, unified
translated to english

/**	@page ClassExample3  Sample of creating class (methods and fields)

To create a class of your own, which
- could be constructed by users,
- has methods 
- AND fields
[like 'image' class], 
one need to create simple class, see @ref ClassExample1, 
and override Methoded::create_new_value to

@code
class MExample3 : public Methoded {
public: // VStateless_class
	
	Value *create_new_value(Pool& pool) { return new(pool) VExample3(pool); }
@endcode

This methods would be called when user would creates values of your type:
@verbatim
$variable[^example3::create[]]
@endverbatim

Here "VExample3", is value class, see ClassExample2.
It need not be registered, because it has Methoded::used_directly set to true.
But it should override:
	VStateless_class *get_class() { return example_class3; }
where example_class3 is global instance of MExample3.

*/

E-mail: