Umubyeyi137 Umubyeyi137
  • 18-05-2018
  • Computers and Technology
contestada

How to separate a local and private variable of the same name c++?

Respuesta :

tonb
tonb tonb
  • 18-05-2018
If you have a private class variable, say private int a; and a local function variable int b; then a and b can be used in that function in the same way, you can't spot the difference. A couple of conventions exist to make this more visible in your program:

- prefix the class member variables with something like m or m_ (just an underscore is done in c# but you can run into clashes with reserved names in c++)
- always dereference them with this->a
Answer Link

Otras preguntas

If you came to the new world how would you survived
A 12cm candle is placed 6cm from a converging lens with a focal length of 15cm. What is the height of the image of the candle? Show all calculations and use SAL
why is breaking down a compoud into its elements considered a chemical change
Simplify the expression a-2b, when a=1.4 - 2x and b=-0.2x + 1.7 *
A technique for classifying problem areas according to degree of importance, and focusing attention on the most important problem areas is referred to as:
which is biggest River in Europe​
Pls help ??? ok pls if you help Ill really need it cus it’s due tomorrow
Evaluate the expression 2(8-4) - 10 ÷ 2
The sum of twice a number and another number is 24. The difference of twice the first number and the other number is 12. Which system would model this situation
3 • { [ 4 ÷ 2 ] + 2 answer