Deriving from TSharedAttribute and TInternalAttribute

When creating a new type of shared attribute, you derive two new classes, one from TInternalAttribute and one from TSharedAttribute. For example, if you write a TColorAttribute you also write TInternalColorAttribute.

Figure 53 illustrates the parallel inheritance and instantiation hierarchy.


When you derive from TSharedAttribute, follow these steps:

  1. Define the constructors and assignment operator as before.
    The standard constructors instantiate your corresponding internal attribute class and call AdoptByManager to register it. The copy constructor just calls SetInternalAttribute, passing the internal attribute from the source.
  2. Export the data access protocol of the internal attribute.
    Each data access method calls GetInternalAttribute and simply redirects the call to the internal attribute.
The procedure for deriving from TInternalAttribute is the same as that for deriving from TAttribute directly.


[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