The Five-Minute Forums  

Go Back   The Five-Minute Forums > FiveMinute.net > Miscellaneous
Register FAQ Community Calendar Today's Posts Search

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-02-2003, 12:38 AM
Angstrom Angstrom is offline
Member
 
Join Date: Apr 2004
Posts: 14
Default

[color=#000000:post_uid0]What's wrong with this code?

[b:post_uid0]ZStreamable.hpp[/b:post_uid0]
[code:1:post_uid0]namespace zilla {
class ZStreamable;
}

std::ostream& operator<<(std::ostream& out, const zilla::ZStreamable& obj); // line 13

namespace zilla {
class ZStreamable {
public:
ZStreamable ();
virtual ~ZStreamable ();

virtual void render (std::ostream &out) const = 0;

friend std::ostream& operator<<(std::ostream& out, const zilla::ZStreamable& obj); // line 23
};
}[/code:1:post_uid0]

[b:post_uid0]PageFooter.hpp[/b:post_uid0]
[code:1:post_uid0]namespace zilla {
class PageFooter : public ZStreamable {
public:
virtual void render (std::ostream &out) const;
};
}[/code:1:post_uid0]

[b:post_uid0]index.cgi.cpp[/b:post_uid0]
[code:1:post_uid0]// other code, main, etc etc
cout << PageFooter (); // line 72
// mode code[/code:1:post_uid0]

[b:post_uid0]make[/b:post_uid0]
[code:1:post_uid0]g++ -g -Wall -pedantic -ansi -lcgicc index.cgi.cpp HTTPHTMLCharsetHeader.o XHTMLDoctype.o PageFooter.o ZStreamable.o -o index.cgi
index.cgi.cpp: In function `int main(int, char**)':
index.cgi.cpp:72: ambiguous overload for `std::ostream& << zilla::PageFooter'
operator
ZStreamable.hpp:13: candidates are: std::ostream& operator<<(std::ostream&,
const zilla::ZStreamable&)
ZStreamable.hpp:23: std::ostream&
zilla::operator<<(std::ostream&, const zilla::ZStreamable&)
ZStreamable.hpp:23: std::ostream&
zilla::operator<<(std::ostream&, const zilla::ZStreamable&)[/code:1:post_uid0][/color:post_uid0]
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 11:03 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.