![]() |
|
|
|
| ||||||
|
Welcome to the The ProgrammersTalk Community forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| Tags: arrow, means, what is |
![]() |
![]() | | LinkBack | Thread Tools | Display Modes | ![]() |
| |
| |||
| well when you want to call a function using pointers you usde -> Example : We have a class Student and this class has the function getstudentname(); in the main : Code: void main()
{
Student s;
Student *sptr;
sptr=&s;// sptr is pointing to all the functions of s
so we use :
sptr->getstudentname(); Last edited by TeraTask : 11-19-2007 at 10:57 AM. Reason: Added code tags |
| The Following 2 Users Say Thank You to Bacteria For This Useful Post: | ||
HelloWorld (11-19-2007), TeraTask (11-21-2007) | ||
| |||
| well buddy,-> operator is used when you want to use data members or member functions of a class using that class's object's pointer. ex: class C{ public: int x; void get(int a){ x=a; } }; void main(){ C c; C *c1; c1=c; c1->a(3); cout<<c1->x; } |
| ||||
| For the difference between the . and -> operators, I suggest checking out Member Access Operators: . and -> (C++) . Essentially, the difference has to do with whether you're dealing with a pointer or not and needing to dereference. Quote:
|
| The Following User Says Thank You to TeraTask For This Useful Post: | ||
HelloWorld (11-21-2007) | ||
![]() |
| Thread Tools | |
| Display Modes | |
| |