Classes and objects

  • bolded text

    I want to know a thing what is the use of scope operators in classs and objects ?
    Pls brief me,thanks in advance !

  • In C++, scope resolution operator is ::. It is used for following purposes.

    1. To access a global variable when there is a local variable with same name

    2. To define a function outside a class.

    3. To access a class’s static variables

    4. In case of multiple Inheritance:
      If same variable name exists in two ancestor classes, we can use scope resolution operator to distinguish.

Log in to reply

Powered by dubbtr | @2019

Looks like your connection to dubbtr was lost, please wait while we try to reconnect.