473,320 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

Hello,

i try to implement a streambuffer. I overwrote streambuf::overflow() 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::overflow().

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() ?
--
Johannes B.
Dec 29 '05 #1
1 2491

Johannes Barop wrote:
Hello,

i try to implement a streambuffer. I overwrote streambuf::overflow() 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::overflow().

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.

Dec 29 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Valery | last post by:
hi All, how to make a member function, which is virtual not for a single object, but for the *pair* of objects?.. Here goes the skeleton of the code, which should ideally print "ABCD":...
3
by: Markus Dehmann | last post by:
I have a two different value types with which I want to do similar things: store them in the same vector, stack, etc. Also, I want an << operator for each of them. class Value{}; // this would...
12
by: cppaddict | last post by:
Hi, I know that it is illegal in C++ to have a static pure virtual method, but it seems something like this would be useful when the following 2 conditions hold: 1. You know that every one...
14
by: mshetty | last post by:
Hi, I get an error "Warning: b::a_method hides the virtual function a::a_method()." on compiling the following code.. #include <iostream.h> class a {
6
by: kelvSYC | last post by:
This little bit of seeminly innocent code seems to give me these two errors, all on the line that declares check(). Is there some part of C++ that I'm missing out on? class Condition { public:...
175
by: Ken Brady | last post by:
I'm on a team building some class libraries to be used by many other projects. Some members of our team insist that "All public methods should be virtual" just in case "anything needs to be...
8
by: Asfand Yar Qazi | last post by:
Hi, I have the following header file in my 'everything useful I think of in one place' library: ============= BEGIN CODE SNIPPET =========== /** All classes that derive from this obtain a...
10
by: Angel Tsankov | last post by:
Hello! Is the following code illformed or does it yield undefined behaviour: class a {}; class b {
18
by: desktop | last post by:
I have 3 types of objects: bob1, bob2 and bob3. Each object is identified by a unique ID which gets returned by the function getId(). All bobs are descendants from class BaseBob which is an...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.