Figure 4 shows the inheritance graph which I had in mind when I wrote the excercise. It makes no use of multiple inheritance and just covers the fact, that I want each object to have a reference point.
Figure 4: Fourth version of inheritance graph.
When I discussed this with one of my colleagues (who is mathematically oriented) he stated that he would divide the set of classes/objects into 2D and 3D-objects. This is because both types require a different ``space''. This would lead to an inheritance graph as shown in Figure 5.
Figure 5: Fifth version of inheritance graph.
In the other hand, if we talk about object-orientation and want to reuse as much as possible, we could argue for all versions which let 3D-Point inherit from Point. For example, assume that Point defines a method to move around:
class Point {
attributes
int x, y
methods
move(int dx, dy) {
x <- x + dx
y <- y + dy
}
...
}
If we let 3D-Point inherit from Point we could formulate a move method in 3D as:
class 3D-Point inherits from Point {
attributes
int z
methods
move(int dx, dy, dz) {
Point::move(dx, dy)
z <- z + dz
}
...
}
Here, 3D-Point::move() reuses the move method of Point. Graphically interpreted, we first move a 3D object in its xy-plane and then move it in z-direction.