What is the difference between a field and a variable?

I am using Visual Studio to develop a C ++ application. I am not an expert in C ++, nor other languages ​​derived from C, like C #. So, while studying the visual symbolism of the studio , I found a link for the same symbol, which is called "Field or Variable". It’s right if I’m wrong, but it almost sounds to me like the definition of “Method or function”.

There are no methods in C ++; instead, they are usually called functions. Thus, in C ++ there are also no fields, this is a feature of C # that works as a variable, except that it must be private and must be accessed from the "Get" call. I am wrong?

+4
source share
1 answer

Not all variables are fields. Local variables of a method are variables, but not fields. The parameters of a method, property, constructor, or anonymous method are variables, but not fields.

Not all fields are variable. A constis technically a field, but it is not a variable.

+4
source

All Articles