Example Use of Collection Classes

Topics

Topic

Detail

See also

Example Code

Consider the following source code:

 

class Class1

{

 

public:

 Class1();

 virtual ~Class1();

 CMap<CString,LPCTSTR,Class3*,Class3*> att;        

 Vector<Class2> *att1;

 TemplatedClass<class1,class2> *att2;

 CList<Class4>  *att3;

};

 

class Class2

{

public:

 Class2();

 virtual ~Class2();

 

};

 

class Class3

{

public:

 Class3();

 virtual ~Class3();

 

};

 

class Class4

{

public:

 Class4();

 virtual ~Class4();

};

 

template<class TParam1, class TParam2>

class TemplatedClass

{

public:

 TemplatedClass() {

 }

 virtual ~TemplatedClass() {

 }

};

 

 

 

Generated Diagram

If this code above is imported into Enterprise Architect with default import options, the following diagram is generated:

AddCollClassDefault

 

If, however, you enter the value CList<#Type#> in the Additional Collection Classes field in the language options page (C#, Java, C++), an Association connector is also created to Class 4:

addcollclassoption

 

C# Options

Java Options

C++ Options