Chapter 16 Working with C++
This section explains how to design C++ objects in the PowerDesigner Object Oriented Model.
The extended attribute UseNamespace allows you to generate a classifier inside a namespace declaration. You should set the extended attribute value to True.
The problem of bidirectional associations is addressed by using forward declarations instead of includes.
Consider a bidirection association between ClassA and ClassB.
The generated code in A.h would be the following:
#if !defined(__A_h)
#define __A_h
class B; // forward declaration of class B
class A
{
public:
B* b;
protected:
private:
};
#endif
The generated code in B.h would be the following:
#if !defined(__B_h)
#define __B_h
class A; // forward declaration of class A
class B
{
public:
A* a;
protected:
private:
};
#endif
This approach will not work if one of the classes is an inner class because it is not possible to forward-declare inner classes in C++.
If such a situation occurs, a warning message is displayed during generation, and the corresponding code is commented out.
PowerDesigner does not support the following C++ features:
| Copyright (C) 2008. Sybase Inc. All rights reserved. |
| |