Unified Control-Data Flow Diagrams (UCDF) Reference
Class inheritance
Classes and
Virtual Functions
Class hierarchy relation is "is", the same
as for type description for data holders.
But there is a difference. "is" for class
inheritance is the same as "has":
a derived class A2 "has" members of the
base class A. It reads "instances of A2
have all the members specified in A".
The relation arrow "has" from a dataholder
to its type is possible, but the opposite,
an arrow "has" from a class to its instance
is prohibited. A class can "have" only
functions and other members, but not
its instances.
"is" arrow direction does not have to be
up, it can be left, right, down, anywhere.
Accessing virtual
functions
Assume we have a base class A and derived
classes B1 and B2. Somewhere in the code
there is a pointer to A and a call to
its virtual function A::F(). How to reflect
that any of actual functions B1::F() or
B2::F() may be called? There is no
order-control lines. "if" rhomb can be
used or "or" box, but it can be omitted.
Class A
Class A2
Class A
A a
Class A
Class A2
A *p;
// more code
p->F();
B1::F()
B2::F()
Condition as informational content
may be shown.
A *p;
p->F();
B1::F()
B2::F()
p is *B1
p is *B2
The diagram reads: "p is a pointer to
an instance of the class A. F() is its
virtual function. At this point, we do
not know what objects were created,
therefore,
any of B1::F() or B2::F() can be called."
Class A
A a
WRONG
Next
is
is
THE SAME
has
has