Path: utzoo!attcan!uunet!mcsun!ukc!warwick!laucy From: laucy@warwick.ac.uk (TS Wong) Newsgroups: comp.lang.c++ Subject: Problem on virtual function. Message-ID: <485@lily.warwick.ac.uk> Date: 13 Apr 90 21:30:42 GMT Reply-To: laucy@warwick.ac.uk (TS Wong) Organization: Computing Services, Warwick University, UK Lines: 33 The compiler give me a strange error message (I haven't acturally got any constructor inside the class definition.) when I compile the following code. The message will disappear if the virtual declaration is removed. Is it a bug, or when we declare a virtual function a invisibly constructor is created? Can anyone told me why? Thanks in advance. N.B. I'm using AT&T C++ Ver.2.0 CC t.c: "t.c", line 10: error: member c::test of class a with constructor in union 1 error --------------------------------- #include class a { public: virtual void test() { cout << "Hello" ; } } ; union c { a test ; } ; main() { c f ; } ------------------------------- laucy@uk.ac.warwick.cu