www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - virtual d'tor definition not allowed in class

↑ ↓ ← Richard <fractal clark.net> writes:
umm..

Guess I'm confused about something here.

I try:

class test {
public:
test() { }
virtual ~test() = 0 { };
};

and get from compiler:

//sc blah.cpp -Ae -mn -C -WA -S -NL -3 -a8 -c -gf -D_MT=1
-D_STLP_NO_NEW_IOSTREAMS=1 -oblah.obj
//Error: D:\APPS\DM\APPLIANCE\blah.h(60): ';' expected following declaration of
struct member

If I remove pure virtual constraint, or move definition out of class, all is
well. Am I missing something about the rules of virtual d'tor definition in
classes?

Richard
Nov 01 2002
"Matthew Wilson" <dmd synesis.com.au> writes:
An initial reaction is to question whether it is the trailing semi-colon

"Richard" <fractal clark.net> wrote in message
news:aptlqs$ah7$1 digitaldaemon.com...
 umm..

 Guess I'm confused about something here.

 I try:

 class test {
 public:
 test() { }
 virtual ~test() = 0 { };
 };

 and get from compiler:

 //sc blah.cpp -Ae -mn -C -WA -S -NL -3 -a8 -c -gf -D_MT=1
 -D_STLP_NO_NEW_IOSTREAMS=1 -oblah.obj
 //Error: D:\APPS\DM\APPLIANCE\blah.h(60): ';' expected following

 struct member

 If I remove pure virtual constraint, or move definition out of class, all

 well. Am I missing something about the rules of virtual d'tor definition

 classes?

 Richard

Nov 01 2002
↑ ↓ → Richard <fractal clark.net> writes:
In article <aptm8d$ark$1 digitaldaemon.com>, Matthew Wilson says...
An initial reaction is to question whether it is the trailing semi-colon

Sorry. Adding the ";" was a knee jerk reaction when compiler gave error. I accidently posted posted that. Compiler responds the same with or without trailing ";". Richard
Nov 01 2002
Christof Meerwald <cmeerw web.de> writes:
On Fri, 1 Nov 2002 10:42:36 +0000 (UTC), Richard wrote:
 I try:
 
 class test {
 public:
 test() { }
 virtual ~test() = 0 { };
 };
 

 If I remove pure virtual constraint, or move definition out of class, all is
 well. Am I missing something about the rules of virtual d'tor definition in
 classes?

See 10.4 Abstract classes of the C++ Standard: (2) ... [Note: a function declaration cannot provide both a pure-specifier and a definition -end note] [Example: struct C { virtual void f() { }=0; // ill-formed }; -end example] bye, Christof -- http://cmeerw.org JID: cmeerw jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net?
Nov 01 2002
↑ ↓ Richard <fractal clark.net> writes:
In article <aptp10$dfk$1 digitaldaemon.com>, Christof Meerwald says...

See 10.4 Abstract classes of the C++ Standard:

Thanks Christof. Is there an online reference to the C++ standard? Richard
Nov 01 2002
↑ ↓ Christof Meerwald <cmeerw web.de> writes:
On Fri, 1 Nov 2002 17:56:57 +0000 (UTC), Richard wrote:
See 10.4 Abstract classes of the C++ Standard:


The November 1996 working paper is available from http://www.dfv.rwth-aachen.de/doc/c++std/ and you can buy the PDF version from the ANSI Webstore for USD 18 (http://webstore.ansi.org/ansidocstore/product.asp?sku=ISO%2FIEC+14882%2D1998) bye, Christof -- http://cmeerw.org JID: cmeerw jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net?
Nov 01 2002
↑ ↓ → Richard <fractal clark.net> writes:
The November 1996 working paper is available from
http://www.dfv.rwth-aachen.de/doc/c++std/ and you can buy the PDF version
from the ANSI Webstore for USD 18
(http://webstore.ansi.org/ansidocstore/product.asp?sku=ISO%2FIEC+14882%2D1998)

WOW. Thanks so very much. Richard
Nov 02 2002