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

Tyler returned $500 worth of merchandise within the discount period. The entry to record the return is which of the following?  A. Debit Purchas
tecnological solutions have good and bad effects .what is a bad effect of spraying a chemical pesticide on crops A. It is dangerous to humans B.it Kills all in
Geologic time is divided into units based upon types of ___. A-sedimentary rocks. B-climate changes. C-organisms. D-igneous rocks
If f(x) =  − 5, what is f(8.6)?
Find the area of grass in this home landscape diagram.
PLZ HELP WITH MATH!! WILL MARK!!
Which sti can cause blindness nervous system damage paralysis and dementia?
How did the Central Pacific and Union Pacific railroad companies profit from constructing the railroad? by selling railroad lines back to the government at a pr
In Lincoln's First Inaugural Address, he tells Southerners who have seceded the following:
What caused the revival of native arts in new mexico in the 1920s