Tuesday, 2 October 2012

Scope Resolution Operator








Scope Resolution Operator – This (::) symbol is known as Scope Resolution Operator. In C++ Scope Resolution Operator is used for various purposes including –
  1. Scope resolution operator is used to define a member function outside the class. For Example –
class car
{
                int speed;
public:
                (return type)int getSpeed();
}

Question – In the getSpeed member function set the speed of the car to 100.

int car :: getSpeed()
{
                speed = 100;
}

No comments:

Post a Comment