Graphic Objects > Creating a New Graphic Object Class > Basic Steps to Subtype a Graphic Object
 
Basic Steps to Subtype a Graphic Object
To create derived classes of the IlvGraphic class, you:
1. Create a header file that declares the new class and the necessary overloaded member functions. Not every member function needs to be overloaded.
2. Add the DeclareTypeInfo(); statement in the class definition.
This creates the necessary fields and member function declarations for input/output operations and class hierarchy information.
3. Add the DeclareIOConstructors(ShadowEllipse); statement in the class declaration, which declares two additional constructors:
*The following constructor initializes a new ShadowEllipse graphic object, which is a copy of source:
ShadowEllipse(const ShadowEllipse& source);
*The following constructor initializes a new ShadowEllipse graphic object from the parameters read in the inputfile:
ShadowEllipse(IlvInputFile& inputfile,
IlvPalette* palette = 0);
4. Create an implementation file (usually class.cpp) to implement the member functions that you need. Outside the body of a function, add a call to the two following macros:
*IlvRegisterClass, which updates the class hierarchy information.
*IlvPredefinedIOMembers, which is used to define the member functions copy and read.

Version 5.5.1
Copyright © 2012, Rogue Wave Software, Inc. All Rights Reserved.