Download Umple C++ Code Generator
Transcript
This Umple model is a representation of the following UML model, see Figure 17,
that demonstrates generalization in Umple C++:
Figure 17: Generalization in Umple C++
A generalization in Umple represents an inheritance relationship. Which is a kind
of relationship that states that the class Mentor ‘is-a’ Person. Technically this
should generate a public inheritance relationship between the two classes Mentor
and Person as shown below, the same rule applies for Student ‘is-a’ Person. This
will generate the following declaration in the header file of each class:
//class Student
class Student: public Person {
.
.
.
// class Mentor
class Mentor: public Person {
Now we know that Umple treats inheritance as an ‘is-a’ relationship, and we know
this will generate a public inheritance, what about private inheritance? It is
important to note that private inheritance in fact does not represent an ‘is-a’
relationship. In fact, private inheritance is more of an implementation technique
than a design technique and inferior to composition rather than inheritance. Lets
look at the behavior of private inheritance to understand this more. There are two
54