Designing for C++

This section explains how to design C++ objects in the PowerDesigner Object Oriented Model.

Namespace Declaration for Classifiers

The extended attribute UseNamespace allows you to generate a classifier inside a namespace declaration. You should set the extended attribute value to True.

Bidirectional Associations Management

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.

Unsupported ANSI Features

PowerDesigner does not support the following C++ features:

  • Templates

  • Enums

  • Typedefs

  • Inline methods