Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 28th, 2007, 2:28 PM   #1
Ade
Hobbyist Programmer
 
Ade's Avatar
 
Join Date: Oct 2004
Location: England, UK
Posts: 139
Rep Power: 0 Ade is an unknown quantity at this point
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
Ade is offline   Reply With Quote
Old Mar 28th, 2007, 2:53 PM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old Mar 28th, 2007, 3:07 PM   #3
Ade
Hobbyist Programmer
 
Ade's Avatar
 
Join Date: Oct 2004
Location: England, UK
Posts: 139
Rep Power: 0 Ade is an unknown quantity at this point
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
Ade is offline   Reply With Quote
Old Mar 28th, 2007, 3:18 PM   #4
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old Mar 28th, 2007, 3:20 PM   #5
Ade
Hobbyist Programmer
 
Ade's Avatar
 
Join Date: Oct 2004
Location: England, UK
Posts: 139
Rep Power: 0 Ade is an unknown quantity at this point
Brilliant, thanks a lot!
__________________
Don't wound what you can't kill
Ade is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:36 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC