kirkham@rhea.trl.oz ( NSS) (05/17/89)
I've recently discovered a difference in the behaviour of Zortech C++ and the AT&T front end, concerning the semantics of class derivation. The problem can be reproduced as follows. Consider the following code: class employee { char* name; // ... public: employee* next; void print() { cout << name; } // ... }; class manager : employee { // ... public: void info() { print(); } // ... }; main() { manager jim; jim.info(); } This code compiles on AT&T C++ (Version 1.2.1), however, Zortech C++ (Version 1.04) produces the following error. ZTCPP1 -oe:temp.tmp testdev.cpp ZTC2 e:temp.tmp -otestdev LINK testdev/noi; BLINK 2.13 Copyright (c) 1986-88 by Zortech, written by Bjorn N. Freeman-Benson Error: undefined symbols: _print in testdev.OBJ (testdev.cpp) BLINK complete. Time: 1.98 seconds --- errorlevel 1 My understanding of this is that the function call to `print()', in manager::info(), is not recognised as being a member function of employee. However, on page 196 of `The C++ Programming Language', Bjarne Stroustrup states, `(The above derivation) means that a public member of class employee is a private member of class manager. That is, manager's member functions can use the public members of employee as before, but these members are not accessible to the users of class manager.' The problem is not a major one, since there are ways around it, at the expense of verbosity or less strict data hiding: e.g. making the derivation public. class manager : public employee or writing explicitly void info() { employee::print(); } Does anyone know: a) whether I am misinterpreting Bjarne Stroustrup; b) whether this is a problem with Zortech C++ v1.04; and if b) is true, c) whether this problem still exists in the new version 1.07 compiler. Apologies if this problem has already been covered. I've only been reading comp.lang.c++ for the last few months. Thanks in advance. -- Daniel Kirkham, JANET kirkham%rhea.trl.oz@uk.ac.ucl.cs ACSnet kirkham@rhea.trl.oz UUCP {uunet,hplabs,ukc}!munnari!rhea.trl.oz!kirkham CSnet kirkham@rhea.trl.oz ARPAnet kirkham%rhea.trl.oz@uunet.uu.net Mail: Telecom Research Laboratories, P.O. Box 249, Clayton, Victoria 3168,AUST.
srwmrbd@windy.dsir.govt.nz (ROBERT) (05/22/89)
In article <550@rhea.trl.oz>, kirkham@rhea.trl.oz ( NSS) writes: > > This code compiles on AT&T C++ (Version 1.2.1), however, Zortech C++ > (Version 1.04) produces the following error. > Zortech 1.07 is a major improvement over 1.04 and given the costs of upgrades ($25US for a New Zealand user) it is simply not worth anyone's while tracking down bugs in 1.04. Does anyone know when the next version is due out?