|
|
Using set and get in C Sharp
|
Posted: Jan 13, 2009 10:02 AM
|
|
|
Advertisement
|
What is the point of using set and get in C Sharp?
It seems variables are used differently in this language than in C++.
For some reason, you have to have a static variable defined like this:
public static uint Somenum { set { m_somenum = value; } get { return m_somenum; } }
and prior to this declaration, you need to have this:
public uint m_sumenum;
This seems to be the only way to expose a member of a class to other classes in C#.
The problem is that I seem to be doing this improperly because I get a compile error:
An object reference is required for the non-static field, metod, or property '.......m_somenum"
|
|