Classes and objects



  • bolded text

    0_1554632015308_0B4CAE69-62E6-4C5E-9998-263C7B8DDE01.jpeg
    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 | @2018

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