Derive Your Own Classes from Generated Classes

You can derive your own classes from the generated classes. This is useful when you want to add functionality to the generated classes without defining the new methods in Data Access Builder user-defined methods support, which would require that you re-generated the code. Deriving a new class is preferable to editing the generated class code, because if you ever re-generate the classes from Data Access Builder, you will lose any changes you made.

In the following instructions, the example given is for extending a generated class, Employee, with a new class, myEmployee:

  1. Create your derived class from Employee, as usual with the following code:
    class myEmployee: public Employee
    {
      // add new functionality here
    };
  2. Create a derived manager with the following code:
    typedef EmployeeManagerTemplate<myEmployee> myEmployeeManager

If the derived object is for a Visual Builder application, then you derive the myEmployee class, as in Step 1, above. Then, to use the generated manager class, you must also provide feature code for a copy constructor of this new class (see Visual Builder help for deriving classes and generating feature code). The copy constructor code should be of the following form:

This is necessary because the Visual Builder does not support reference counted element members of sequences.



Data Access Class Library and Generated Code