471,347 Members | 1,774 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,347 software developers and data experts.

Properties - public & protected

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
Jul 21 '05 #1
2 1087
"baylor" <ba****@discussions.microsoft.com> wrote in message
news:28**********************************@microsof t.com...
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.
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

Jul 21 '05 #2
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).
baylor wrote:
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

Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

23 posts views Thread by Marcin Grzębski | last post: by
4 posts views Thread by Andy Breward | last post: by
2 posts views Thread by Marty McDonald | last post: by
2 posts views Thread by Vivek Sharma | last post: by
6 posts views Thread by Raterus | last post: by
2 posts views Thread by Miky | last post: by
2 posts views Thread by baylor | last post: by
reply views Thread by Ronak mishra | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.