views:

18

answers:

1

Hi

i have a web application which has a Base class in which i define all the properties common to the web pages. The base class extends System.Web.UI.Page

Furthermore i have a Base User control class where are defined all the properties common to the user controls. the Base User Control extends System.Web.UI.UserControl

all the properties in both base classes are protected.

All the web pages extends the base class .

All the controls extends the base user control class.

The problem is i can not access the properties defined in the base class from the user

controls and I can not extend two classes in the base user controls

The question is

how can i access the properties defined in the Base class from within the user controls?

I hope i have been clear

Thanks

A: 

If you want to be able to mess with the properties outside of your own class or its subclasses, then "protected" may be the wrong access level. You may be able to use "protected friend" (in vb) or "protected internal" (c#) access to do what you need. The control's class and the page's base class will need to be in the same assembly, but that's probably not an issue for you.

cHao
Do you think it is the right approach?
GigaPr
Depends on what you're doing, and why you have a need to access protected properties outside of the class. Generally, if you find yourself needing that, your access is set too strict. I'd have to see the code to know whether that's the case here, though.
cHao