Problem with std::ostream, std::streambuf and "virtual xsputn"

J

Johannes Barop

J

JH Trauntvein

Johannes said:
Hello,

i try to implement a streambuffer. I overwrote streambuf::eek:verflow() and
streambuf::xsputn(). Both are protected and virtual
(http://www.cplusplus.com/ref/iostream/streambuf/).

But somehow my OutBuf::xsputn() is not beeing used. But the orginal
basic_streambuf::xsputn() calls my OutBuf::eek:verflow().

http://pastebin.com/483016 - OutBuf.h
http://pastebin.com/483018 - OutBuf.cpp
http://pastebin.com/483022 - gdb - Output

Why basic_streambuf::xsputn() is called instead of OutBuf::xsputn() ?


Most likely, the reason is that the signature of your overloaded class'
m,ethod does not exactly match the signature of the base class' method.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top