View Single Post
  #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