Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 10th, 2005, 04:57 AM
Registered User
 
Join Date: Mar 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to kerby
Default c++ concepts

whats the difference of

 
Quote:
quote:SampleClass object;
Quote:

SampleClass *object;
in which SampleClass is a class.

further, what is the difference of

Code:
object.somefunction();
from...


Code:
object->somefunction();
a journey of a thousand miles is started by taking the first step -chinese proverb
Reply With Quote
  #2 (permalink)  
Old April 10th, 2005, 11:45 PM
Authorized User
 
Join Date: Mar 2005
Location: Wagga Wagga, NSW, Australia.
Posts: 60
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to Alan-LB Send a message via Yahoo to Alan-LB
Default

Kerby

SampleClass object creates an object of "SampleClass" type
SampleClass *object creates a POINTER to an object of "SampleClass" type

object.somefunction() accesses "somefunction" within the object "object"
object->somefunction() dereferences a pointer to "object" to access "somefunction"

For you I think the "journey of a thousand miles" should start with the "first step" of carefully reading a few basic text books :-)

Read up on Objects and Pointers

Hope this helps

Alan

Reply With Quote
  #3 (permalink)  
Old April 16th, 2005, 11:38 AM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to merediths
Default


 If you come from a C background think of it this way

 object->somefuntion();

 is the same as

 (*object).somefunction();

 this is, -> dereferences the pointer on the right and then calls it's somefunction() method.

Regards,
Meredith Shaebanyan

Reply With Quote
  #4 (permalink)  
Old April 16th, 2005, 11:39 PM
Authorized User
 
Join Date: Mar 2005
Location: Wagga Wagga, NSW, Australia.
Posts: 60
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to Alan-LB Send a message via Yahoo to Alan-LB
Default

Which is what I said!

Alan

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Blog for QTP for certification help and concepts expertqtp VBScript 0 July 10th, 2008 01:17 AM
Basic concepts with asp.net cool_hari BOOK: Beginning ASP.NET 1.0 1 August 28th, 2006 03:41 AM
Need to Understand Big Picture Concepts newbieprogrammer Classic ASP Databases 3 February 6th, 2005 04:17 PM



All times are GMT -4. The time now is 05:41 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.