View Single Post
Re: C++ overriding methods using virtual
Old
  (#8)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,499
Join Date: Feb 2004
Location: Mist Village
Default Re: C++ overriding methods using virtual - 21-06-2004

I think it's a bug of MSVC since that's actually INVALID, and that test program doesn't compile in GNU GCC and Borland C++ at all:
Quote:
C:\>gcc 1.cpp
1.cpp: In constructor `CSubClass::CSubClass(bool)':
1.cpp:22: parse error before `;' token

C:\>bcc32 1.cpp
Borland C++ 5.6 for Win32 Copyright (c) 1993, 2002 Borland
1.cpp:
Error E2316 1.cpp 22: 'CSuperClass' is not a member of 'CSuperClass' in function
CSubClass::CSubClass(bool)
Warning W8057 1.cpp 45: Parameter 'argc' is never used in function main(int,char * *)
Warning W8057 1.cpp 45: Parameter 'argv' is never used in function main(int,char * *)
*** 1 errors in Compile ***
also I think if the constructor of base class if NOT virtual it will automatically get called before the constructor of sub class gets called.
  
Reply With Quote