| | |
Need Help with a question
![]() |
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 application array based binary bitmap c# c++ c/c++ char class classes code coding compile compression console conversion count cpm delete deploy deque desktop developer dialog directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer introductory java lib linkedlist linkednodes linker loop looping loops map math matrix memory multiple news node numbertoword output parameter pointer problem program programming project python random read recursion reference rpg security sorting string strings temperature template test text text-file tree url variable vector video whyisthiscodecausingsegmentationfault win32 windows winsock wordfrequency wxwidgets






