C Board  

Go Back   C Board > General Programming Boards > C++ Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 11-20-2008, 08:27 PM   #1
Registered User
 
Join Date: Jul 2007
Posts: 2
Default Method

Hi,

I am new to C++, passionate about the perspective it offers but still find that the learning curve is somehow steep ;-)

I am trying to put together a little String object, defining it as a type.

I would like my object to return its content through a "default" method. That way I could console out the "content" (so to speak) of the String without having to explicitly call its Text (or Value whatever) method.

Something like
cout << myString << endl;

thank you very much !
SolarEnergy is offline   Reply With Quote
Old 11-20-2008, 08:33 PM   #2
Nor
‡ †hë Ö†hÈr sîÐè ‡
 
Nor's Avatar
 
Join Date: Nov 2001
Posts: 274
http://faq.cprogramming.com/cgi-bin/...ring&match=all

Try reading the tutorials this site offers.
__________________
Try to help all less knowledgeable than yourself, within
the limits provided by time, complexity and tolerance.
- Nor
Nor is offline   Reply With Quote
Old 11-21-2008, 01:58 AM   #3
The larch
 
Join Date: May 2006
Posts: 3,220
You need to overload operator << for std::ostream and String (and perhaps also >> for std::istream and std::getline).
__________________
I might be wrong.

Quote:
Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
Quoted more than 1000 times (I hope).
anon is offline   Reply With Quote
Old 11-21-2008, 07:20 AM   #4
Registered User
 
Join Date: Jul 2007
Posts: 2
Quote:
Originally Posted by anon View Post
You need to overload operator << for std:stream and String (and perhaps also >> for std::istream and std::getline).
I should have thought about it. Thanks a lot !!
SolarEnergy is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Overriding a method in C DavidDobson C Programming 1 07-05-2008 07:51 AM
Bisection Method function value at root incorrect mr_glass C Programming 3 11-10-2005 09:10 AM
Open default browser and send an HTTP request (POST Method) dit6a9 Windows Programming 3 09-03-2005 01:31 AM
How to pass non-static method to signal() function? registering C++ Programming 3 11-06-2003 04:33 PM
Returning an object from a method - Problem when creating my own string class pecymanski C++ Programming 3 12-03-2001 01:45 PM


All times are GMT -6. The time now is 09:13 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22