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

I really don't understand what they are asking but I understand 12 is C
Explain the following statement: A cell low in ATP is probably starving for raw materials...
Can someone help with this please
The measure of an exterior angle of triangle is. Equal to the measure of either romote interior angle
Which group was persecuted during the Holocaust for religious and political reasons? A. Intelligentsia B. Jehovah’s Witnesses C. Roma D. Communists
What is 20 % of 50? Did I do this right?
The South African government consists of 5 democratic structures . Identify the role that the five democratic structures play in society
A sentence for the words calamity and generated
Michael just drank a cup of coffee to help him stay awake. The coffee had 110 milligrams of caffeine in it. If his body processes 5% of the caffeine every hour
what do we learn about jordan baker in chapter 3