
VS .NET Does Not Complain When Pure Virtual Method Isn't Defined
| >Newsgroups: microsoft.public.dotnet.languages.vc
| >Subject: VS .NET Does Not Complain When Pure Virtual Method Isn't Defined
| >Date: Fri, 21 Feb 2003 13:37:26 -0500
| >
| >I was implementing the IDisposable interface in several of my managed
| >classes using MC++. In one case, I accidentally inherited from
IDisposable
| >in a class that did not implement Dispose(). The compiler did not
complain
| >(or even warn) when I compiled the DLL. The DLL does create instances of
| >this particular (value) class, so I would have expected a compiler
error, or
| >at least a linker error when the linker could not find the definition for
| >the Dispose method. Here is what the class declaration looks like:
| >
| >public __value class MyClass : public IDisposable //note: no Dispose
method
| >declared/defined
| > {
| > public:
| > Int32 Freq;
| > MyFlag Flags;
| > Byte Collapse;
| > };
| >
| >I have a Windows Forms GUI written in C# that uses this class. It, of
| >course, through a run-time exception when it couldn't find the definition
| >for the class' Dispose() method.
| >
| >My only thoughts were that this was a value class and/or this class is
| >'inline' (i.e. no methods defined in a source file that are not inline).
| >Those are just thoughts though. Any ideas why the compiler did not
| >complain?
| >
| >Thanks,
| >
| >Tim Rogers
| >
|
*** this is a bug in the compiler, and is fixed in the 7.1 compiler visual
studio 2003 due for release in april.
sorry for the grief :-(
--
Stanley Lippman, Visual C++ Team
This posting is provided AS IS with no warranties, and confers no rights.