| | |
Need Help with a question
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
this is a special pointer that points to the active object. For example:
Hope this helps.
C++ Syntax (Toggle Plain Text)
#include <iostream> #include <string> using namespace std; class WhoAmI { string name; public: WhoAmI( const string& name ): name( name ) { } void print( const WhoAmI& other ) { cout << "I am " << this->name << endl; if (this == &other) cout << "I am beside myself.\n"; else cout << "I am with " << other.name << endl; } }; int main() { WhoAmI george( "George" ); WhoAmI alannah( "Alannah" ); george.print( george ); alannah.print( george ); return 0; }
![]() |
Similar Threads
- C command-line I/O question (C++)
- Apache Alias Directive... mod_alias question (Linux Servers and Apache)
- Completely new to C++ and have question about using char (C++)
- Question (Geeks' Lounge)
- question on cooling (Cases, Fans and Power Supplies)
- Context-sensitive grammar question :( (Computer Science)
- Welcome PC Mod Kingdom peeps! (Geeks' Lounge)
- Laptop LCD built into a car? (Monitors, Displays and Video Cards)
- Changing Network Configuration (*nix Software)
Other Threads in the C++ Forum
- Previous Thread: winsock help
- Next Thread: Character Escape Sequences (and Error Decryptors)
| Thread Tools | Search this Thread |
api array based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count data database delete deploy developer dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linker list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings struct temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






