J.Schmidt@lut.ac.uk (J Scmidt) (05/07/91)
I hope if anybody could help me with this problem: I have defined the class Ordinary. Objects of this class are interconnected by pointers which carry much of their semantics (not simple lists or sets). The class has operations navigating along these pointers. In the future other people will want to enhance the object in different ways (attaching various attributes, graphical appearance etc.) but the basic navigation will still be needed. The most natural way (I think) is to derive classes like Advanced from the Ordinary. As Advanced* can be converted to Ordinary*, the network of pointers can be constructed without problems. The problem is that the basic navigational operations will return a pointer or a reference to Ordinary and there is no way to convert them to Advanced*. Even if I adopt the technique outlined in the ARM p.212 so that I know what object is the pointer referring to, I still will be unable to convert it and use Advanced's additional features. No one solution I have thought about is satisfactory: - use void* and mask the ugliness somehow (how?): too big project for this - use templates or macros: ideally objects of various Advanced classes should cooperate - delegate the connectivity to a container class (Ordinary World): does not solve the problem; Advanced World will be necessary - do not use inheritance: again, cooperation of various objects will be needed Thanks. J.Schmidt Czech Tech. Univ., Dept. of Computers, Karlovo nam.13 CS-121 35 Prague 2, Czechoslovakia, currently with Loughborough Univ. of Technology, Dept. of Comp. Studies, Loughborough, Leicestershire LE11 3TU United Kingdom