What namespaces are you using. You have declared the friend operator as: std::ostream& operator<<(...) and implemented it as: std::ostream& jme::operator<<(...) Without a maching output operator, the compiler will emit the pointer to the object instead. /Per W On Thu, 30 Jun 2005 jalkadir@xxxxxxxxxx wrote: > In my class, when I use the "getter" to display the value I get the right > output, but when I try using the overloaded extractor operator (<<) I get > some hex value displayed. Here is some of the code: > --- snip > Main.cpp > int main() { > Money money("12.21"); > > std::cout << "Value is: " << money.getAmount() << std::endl; // 12.21 > std::cout << "Value is: " << money << std::endl; // hex value???? > return 0; > } > > > > The class goes like this: > ---snip > Money.hpp > class Money { > protected: > float amount; //!< This variable holds the numerical value > public: > //! Constor > Money(const std::string&); > > //!Copy constructor > Money( const Money& ); > > //!Destructor > ~Money() { std::cout << amount << std::endl;} //<<=== 12.21 > > // Setters > ... > // Getters > const float getAmount() const; > > // Overloaded operators > ..... > friend std::ostream& operator<<( std::ostream&, const jme::Money& ); > friend std::istream& operator>>( std::istream&, jme::Money& ); > .... > } ; //Money > > > > and the code looks like this > --- snip > jme::Money::Money( const std::string& x){ > this->setAmount(x); // this metho converts the std::string to a float > } > const float jme::Money::getAmount() const { > return this->amount; > } > std::ostream& > jme::operator<<( std::ostream& os, const jme::Money& obj ) { > os << obj.getAmount(); //<<==== 0x4b1120 > return os; > } > ----- end of snip > As you can see when using the member method getAmount() the value > displayed is in the right format, however the extractor operator is not > doing _______________________________________________ gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list