I've seen several occurrences in tutorials where i variables with an "m" in front of the actual name. At first I thought it meant "my" but after really keeping a lookout for these "m"'s I'm no longer sure what it means. Does anyone know where this convention comes from?
As stated in the other answers, m_ prefix is used to indicate that a variable is a class member. This is different from Hungarian notation because it doesn't indicate the type of the variable but its context.
The use of the "m" prefix is more specific that simply denoting a "member" variable: It's for "non-public, non-static field names." Great link, not just for prefixes.
M-code (for “miscellaneous function”) is an auxiliary command; descriptions vary. Many M-codes call for machine functions like “open workstation door,” which is why some say “M” stands for “machine”, though it was not intended to.
Letter m as prefix means that it is member of class. Letters lv means that it is local variable. Letters pm means that it is parameter. example: class Example { Integer mMemberOfClass; public void someMethod(Object pmSomeParameter) { Integer lvSomeLocalVariable; } }
m
is to indicate that it is a member variable, it is common variant on Hungarian Notation. Other common prefixes to look out for are I
for interface and C
for class.
Depending on the language, it is also common to prefix s
for string and b
to indicate a boolean.
It's commonly used to mean that variable is a member of class. For example it's useful in situations like this:
someclass::somefunc()
{
...
.
.
m_myvar = 1;
lvar = 2;
.
.
.
}
You can tell at a glance that m_myvar
is a member of someclass
but lvar
is not.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With