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

Discussion in 'ASP .Net Building Controls' started by Ingvar Nilsen, Dec 16, 2004.

  1. 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.

    --
    Ingvar Nilsen
     
    Ingvar Nilsen, Dec 16, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page