![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: Oct 2004
Location: England, UK
Posts: 139
Rep Power: 0
![]() |
C++ Symbol Question... ' -> '
Hi guys. I know this is probably a laughable question but I'm wondering with the symbol -> means in the context of a class. The example I can give is from the text book I'm reading at the moment: 'Mfc Programming with Visual c++'.
CClient *pClient; pClient = new CClient; pClient->Input(); If you need to know more about the example please let me know and I will post the whole code as that's just selected lines. I guess that it means that the function 'input()' should act on pClient? Sorry if this is really simple but googling '->' obviously comes up with nothing and I don't know what it would be called? Thanks in advance.
__________________
Don't wound what you can't kill |
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
It dereferences a pointer in an object context. pClient is a pointer to an object that has an Input () member function. Your statement executes that one, rather than an Input () member of some other class.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#3 |
|
Hobbyist Programmer
Join Date: Oct 2004
Location: England, UK
Posts: 139
Rep Power: 0
![]() |
Cheers for the reply. It's times like this I wish I practised my c++ all year round and not just in the two months before assignments are in!!
So pClient is a pointer to an object. The object is of type CClient? Would that mean that Input() is a member function of the class CClient?
__________________
Don't wound what you can't kill |
|
|
|
|
|
#4 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
That would be correct.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#5 |
|
Hobbyist Programmer
Join Date: Oct 2004
Location: England, UK
Posts: 139
Rep Power: 0
![]() |
Brilliant, thanks a lot!
__________________
Don't wound what you can't kill |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Wierd compile Error. Need help please. | Keiyentai | Java | 7 | Aug 19th, 2006 1:35 AM |
| C++ OWL What am I doing wrong | Vagabond | C++ | 7 | Mar 24th, 2006 5:31 PM |
| Attitudes | Oddball | Coder's Corner Lounge | 29 | Mar 18th, 2006 9:34 PM |
| Problem Compiling this program | OUfanAP12 | Java | 4 | Nov 7th, 2005 7:27 PM |
| Errors in microjava midlet | freddielj | Java | 1 | Apr 8th, 2005 11:02 AM |