Path: utzoo!attcan!uunet!hite386!steve From: steve@hite386.UUCP (Usenet mail account) Newsgroups: comp.lang.c++ Subject: Zortech C++ bug Keywords: Zortech, bug Message-ID: <5@hite386.UUCP> Date: 4 Mar 89 19:32:04 GMT Organization: Tillinghast, Inc. Lines: 48 The Zortech C++ compiler v1.07c has a problem with the following code: #include class Node { public: virtual void print(ostream& o) { o << "I am a Node\n"; } }; class IntNode : public Node { public: int n; IntNode(int a = 0) : n(a) {} void print(ostream& o) { o << "I am an IntNode with value " << n << "\n"; } }; main() { Node n; IntNode in(17); n.print(cout); in.print(cout); in.Node::print(cout); } The expected output is: The output of ZTC++ v1.07c is: I am a Node I am a Node I am an Intnode with value 17 I am an Intnode with value 17 I am a Node I am an Intnode with value 17 Comments? With appreciation: The above code example was taken from "The Journal of Object Oriented Pro- gramming" Jan/Feb 1989 (C) 1989 by SIGS Publications, Inc. Permission was granted verbally to me by publisher Richard P. Friedman to post this code from Andrew Koenig's C++ column entitled "How Virtual Functions Work", pages 73-74, to Usenet. Steve Hite Jacksonville, Florida uunet!hite386!steve