Click here to Skip to main content
15,891,529 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionInheritance problem Pin
khb13-Jul-06 3:27
khb13-Jul-06 3:27 
Hi together,

I tried to compile the fdstream classes from www.josuttis.com with VC6, but didn't succeed. I cut down the code to what doesn't work:
#include <streambuf>
#include <istream>
 
class mybuf : public std::streambuf
{
protected:
	int m_i;
public:
	mybuf(int i) : m_i(i) {}
};
 
class myistream : public std::istream
{
protected:
	mybuf buf;
public:
	myistream(int i) : std::istream(0), buf(i) {}
};
 
int main(int argc, char* argv[])
{
	myistream strm(5);
	return 0;
}
On this code I get the following two errors:

error C2512: 'basic_istream<char,struct std::char_traits<char> >' : no appropriate default constructor available
error C2614: 'myistream' : illegal member initialization: 'istream' is not a base or member

I can't figure out what's the problem. It seems std::istream(0) isn't accepted, but I don't know why. Dead | X|

Can anyone help me?

Thank you very much in advance.

Regards,
Marcus.
AnswerRe: Inheritance problem Pin
Zac Howland13-Jul-06 4:21
Zac Howland13-Jul-06 4:21 
QuestionRe: Inheritance problem [modified] Pin
khb13-Jul-06 5:13
khb13-Jul-06 5:13 
AnswerRe: Inheritance problem Pin
Zac Howland13-Jul-06 5:18
Zac Howland13-Jul-06 5:18 
GeneralRe: Inheritance problem Pin
earl13-Jul-06 5:20
earl13-Jul-06 5:20 
GeneralRe: Inheritance problem Pin
Zac Howland13-Jul-06 5:25
Zac Howland13-Jul-06 5:25 
GeneralRe: Inheritance problem Pin
earl13-Jul-06 5:29
earl13-Jul-06 5:29 
GeneralRe: Inheritance problem Pin
Zac Howland13-Jul-06 5:33
Zac Howland13-Jul-06 5:33 
GeneralRe: Inheritance problem Pin
khb13-Jul-06 8:01
khb13-Jul-06 8:01 
GeneralRe: Inheritance problem Pin
Zac Howland13-Jul-06 8:03
Zac Howland13-Jul-06 8:03 
GeneralRe: Inheritance problem Pin
khb13-Jul-06 9:00
khb13-Jul-06 9:00 
GeneralRe: Inheritance problem Pin
earl13-Jul-06 12:04
earl13-Jul-06 12:04 
QuestionHow to setrange of spin control Pin
vc++_fragrance13-Jul-06 2:06
vc++_fragrance13-Jul-06 2:06 
AnswerRe: How to setrange of spin control Pin
*Dreamz13-Jul-06 2:25
*Dreamz13-Jul-06 2:25 
GeneralRe: How to setrange of spin control Pin
vc++_fragrance13-Jul-06 2:33
vc++_fragrance13-Jul-06 2:33 
GeneralRe: How to setrange of spin control Pin
David Crow13-Jul-06 2:48
David Crow13-Jul-06 2:48 
GeneralRe: How to setrange of spin control Pin
vc++_fragrance13-Jul-06 17:02
vc++_fragrance13-Jul-06 17:02 
QuestionHow to Specified Position with Priter. Pin
Uday Janaswamy13-Jul-06 0:44
Uday Janaswamy13-Jul-06 0:44 
AnswerRe: How to Specified Position with Priter. [modified] Pin
includeh1013-Jul-06 1:15
includeh1013-Jul-06 1:15 
GeneralRe: How to Specified Position with Priter. Pin
Uday Janaswamy13-Jul-06 1:35
Uday Janaswamy13-Jul-06 1:35 
QuestionWM_COMMAND Pin
ashish dogra12-Jul-06 23:39
ashish dogra12-Jul-06 23:39 
AnswerRe: WM_COMMAND Pin
A_Fa12-Jul-06 23:47
A_Fa12-Jul-06 23:47 
AnswerRe: WM_COMMAND [modified] Pin
_AnsHUMAN_ 12-Jul-06 23:53
_AnsHUMAN_ 12-Jul-06 23:53 
AnswerRe: WM_COMMAND Pin
Hamid_RT13-Jul-06 0:09
Hamid_RT13-Jul-06 0:09 
GeneralRe: WM_COMMAND Pin
toxcct13-Jul-06 1:34
toxcct13-Jul-06 1:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.