Properties - public & protected

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Just to verify, i cannot use properties and have a public get and a protected
set, correct?

i assumed i could either define it twice with different scopes or set the
access visibility at the get/set level but neither is true. So i assume this
means i have to stop using properties and use the Java-style getX()/setX()
methods. But i wanted to verify before i start doing that

-baylor
 
baylor said:
Just to verify, i cannot use properties and have a public get and a
protected
set, correct?

No, not in VS2002 & VS2003, but it will be available in VS2005.
 
Correct. A better alternative to to getX() and setX() might be to go
half-way:
Create a public read only property (only has a getter), and then a
protected setX.
The consumers of your class will still be able to take advantage of the
familiar property style for reading the value (which is all they can do
anyway).
 
Back
Top