Deriving from TAttribute

There are two situations where you need to derive from TAttribute directly and add your own member functions and data members:

Provide copy semantics for the newly defined class, regardless of whether you choose to derive from TAttribute or from the TSharedAttribute and TInternalAttribute pair.

Follow this process when you create a new class:

  1. Declare a default constructor, which is required by streaming.
  2. Declare a constructor with parameters to initialize the attribute data.
  3. Declare the usual copy constructor, destructor, and assignment operator.
  4. Declare the streaming operators.
  5. Optionally, override GetName and GetCategory to return the names you want. If you do not, GetName and GetCategory each use the class name.
  6. Override Hash and IsEqual to take into account your attribute's data.
  7. Declare any private variables that you use and public accessors for them.

[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker