![]() |
| | #1 |
| Registered User Join Date: Jul 2007
Posts: 2
| Default Method 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 | |
| | #2 |
| ‡ †hë Ö†hÈr sîÐè ‡ Join Date: Nov 2001
Posts: 274
|
__________________ Try to help all less knowledgeable than yourself, within the limits provided by time, complexity and tolerance. - Nor |
| Nor is offline | |
| | #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:
| |
| anon is offline | |
| | #4 |
| Registered User Join Date: Jul 2007
Posts: 2
| |
| SolarEnergy is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
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 |