How to make a protected property in the base component public in the derived component?

I

Ingvar Nilsen

I have a base component, from which several components derive.
What I want is to just publish some of the protected properties in the
base component.

public class BaseClass
{
private int FA;
protected int A
{
get {return FA;}
set {FA = value;}
}
}

public class DerivedClass: BaseClass
{
Here I just want to publish the protected property A
}

Can this be done with just a directive?
Or do I need:

new public int A
{
get {return base.A;}
set {base.A = value;}
}

To do this?
I come from another environment, Borland Delphi, where this can be done
in a very simple way, I find the above approach rather cumbersome when
publishing many properties.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,147
Latest member
CarenSchni
Top