The work described in this report was motivated by a desire to understand the implementation of inheritance in C++. In particular a paper by W.Harris entitled "Contravariance for the rest of us" had raised issues concerning the interpretation of overloading in inheritance. We wished to establish whether overloading in C++ is used to maintain the subtype relationship in the way that Harris suggests. Other work on contravariance has addressed the contravariance-covariance debate and C++ is interesting in that it permits neither contravariance nor covariance. This 'no-variance' policy was thought to be worth investigating in relation to subtyping. Before exploring C++, we explain the way in which we use the terms overloading and polymorphism and introduce the C++ concept of virtual functions. Our experiments are concerned with virtual functions since it is these functions which enable inheritance polymorphism to be realised and hence give C++ its object-oriented flavour.
Name | UH Computer Science Technical Report |
---|
Publisher | University of Hertfordshire |
---|
Volume | 202 |
---|