C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Multiple inheritance and destructors

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Christopher Benson-Manica
Guest





PostPosted: Thu Feb 26, 2004 2:03 pm    Post subject: Multiple inheritance and destructors Reply with quote



Okay, having purchased the excellent Josuttis book last night, I've
almost got my little streambuf subclass bit worked out. Now, though,
I'm faced with some issues with the destructors...

public TRFileStream : public TLSFile, public std::streambuf
{
...
};

The problem, I think, is that ~TLSFile is *not* virtual, but
~std::streambuf is. How can I reconcile these two destructors?

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Back to top
John Harrison
Guest





PostPosted: Thu Feb 26, 2004 2:15 pm    Post subject: Re: Multiple inheritance and destructors Reply with quote




"Christopher Benson-Manica" <ataru (AT) nospam (DOT) cyberspace.org> wrote

Quote:
Okay, having purchased the excellent Josuttis book last night, I've
almost got my little streambuf subclass bit worked out. Now, though,
I'm faced with some issues with the destructors...

public TRFileStream : public TLSFile, public std::streambuf
{
...
};

The problem, I think, is that ~TLSFile is *not* virtual, but
~std::streambuf is. How can I reconcile these two destructors?


Not sure there is a problem with that. What problem are you actually seeing?

john



Back to top
Christopher Benson-Manica
Guest





PostPosted: Thu Feb 26, 2004 2:22 pm    Post subject: Re: Multiple inheritance and destructors Reply with quote



John Harrison <john_andronicus (AT) hotmail (DOT) com> spoke thus:

Quote:
Not sure there is a problem with that. What problem are you actually seeing?

Well, with no destructor declared in the function, I'm told

Virtual function '_fastcall TWFileStream::~TWFileStream()' conflicts with base
class 'streambuf'

(note the Borland-specific __fastcall qualifier, which I perhaps
unwisely did not mention in my original post)

I get the same error if I attempt to specify a destructor like this:

__fastcall ~TWFileStream() {;} //or, alternatively
virtual __fastcall ~TWFileStream() {;}

And if I specify it thus (in an attempt to placate std::streambuf):

virtual ~TWFileStream() {;}

Virtual function 'TWFileStream::~TWFileStream()' conflicts with base class
'TLSFile'

Is this stupid Borland qualifier going to ruin what could otherwise be
a wonderful piece of code? I'd appreciate any ideas...

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.

Back to top
John Harrison
Guest





PostPosted: Thu Feb 26, 2004 2:49 pm    Post subject: Re: Multiple inheritance and destructors Reply with quote


"Christopher Benson-Manica" <ataru (AT) nospam (DOT) cyberspace.org> wrote

Quote:
John Harrison <john_andronicus (AT) hotmail (DOT) com> spoke thus:

Not sure there is a problem with that. What problem are you actually
seeing?

Well, with no destructor declared in the function, I'm told

Virtual function '_fastcall TWFileStream::~TWFileStream()' conflicts with
base
class 'streambuf'

(note the Borland-specific __fastcall qualifier, which I perhaps
unwisely did not mention in my original post)

I get the same error if I attempt to specify a destructor like this:

__fastcall ~TWFileStream() {;} //or, alternatively
virtual __fastcall ~TWFileStream() {;}

And if I specify it thus (in an attempt to placate std::streambuf):

virtual ~TWFileStream() {;}

Virtual function 'TWFileStream::~TWFileStream()' conflicts with base class
'TLSFile'

Is this stupid Borland qualifier going to ruin what could otherwise be
a wonderful piece of code? I'd appreciate any ideas...

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.

Well I have no idea about the Borland bit (ask on a Borland newsgroup,
details from their community web page)but since TLSFile doesn't seem to have
been designed for inheritance perhaps you could recode

class TWFileStream : public std::streambuf
{
...
private:
TLSFile m_file;
};

Tedious since you'll have to wrap the entire TLSFile interface, but maybe
it'll work.

john



Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.