4 Replies - 2835 Views - Last Post: 29 March 2011 - 12:55 PM Rate Topic: -----

#1 redchannel  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 69
  • Joined: 05-October 10

Scope resolution operator vs dot operator ?

Posted 28 March 2011 - 09:06 PM

When dealing with classes, when is is appropriate to use the dot operator or the scope resolution operator ?
Is This A Good Question/Topic? 0
  • +

Replies To: Scope resolution operator vs dot operator ?

#2 jimblumberg  Icon User is offline

  • member icon


Reputation: 4278
  • View blog
  • Posts: 13,439
  • Joined: 25-December 09

Re: Scope resolution operator vs dot operator ?

Posted 29 March 2011 - 05:48 AM

The scope resolution operator is used to qualify hidden names so you can use them. See this link. You use the dot operator to access class member objects.

Jim
Was This Post Helpful? 2
  • +
  • -

#3 sakshamkum  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 19
  • View blog
  • Posts: 232
  • Joined: 09-June 09

Re: Scope resolution operator vs dot operator ?

Posted 29 March 2011 - 07:40 AM

the scope resolution orperator is used to refer to members of a pointer object
Was This Post Helpful? 1
  • +
  • -

#4 codeprada  Icon User is offline

  • Changed Man With Different Priorities
  • member icon

Reputation: 948
  • View blog
  • Posts: 2,357
  • Joined: 15-February 11

Re: Scope resolution operator vs dot operator ?

Posted 29 March 2011 - 12:33 PM

//Use of dot operator
AClass a; //a is an instance of class AClass
a.doSomething();

//Use of scope resolution operator
AClass * b = &a; //b is a pointer of type AClass that points to the address of a
b->doSomething();

Was This Post Helpful? 0
  • +
  • -

#5 r.stiltskin  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1833
  • View blog
  • Posts: 4,927
  • Joined: 27-December 05

Re: Scope resolution operator vs dot operator ?

Posted 29 March 2011 - 12:55 PM

-> is NOT the scope resolution operator. It is the "pointer to member operator" or some such clumsy name.

The scope resolution operator is the double colon :: which as jimblumberg said is used to qualify names (to make explicit the scope or namespace in which they are defined).
Was This Post Helpful? 2
  • +
  • -

Page 1 of 1