The code uses the two objects through the A interface and x() is a virtual function on that interface.
[...]
Ali

The book "Programming in D" (r651) says in chapter "57.7 Using the subclass in place of the superclass", in the example about Clock and AlarmClock :

    void use(Clock clock) { ... }
(sic) "In other words, although use() uses the object as a Clock, the actual object may be an inherited type that behaves in its own special way".

Should'nt we understand that the first object is a B, the second object is a C and then should both behave like a B and a C, not like two A ?

Reply via email to