none
Properties in properties. RRS feed

  • Question

  • I have class1. It has a property

    class1
    {
     public Point Top
            {
                get { ... }
                set { ... }
            }
    }


    I have class 2. it has the same property with the same functionality and use class1 property. So is it the best way ?

    class2
    {
    class1 map;

     public Point Top
            {
                get { return this.map.Top; }
                set { this.map.Top = value; }
            }
    }


    May be there are something like inheritance for properties ?
    Monday, April 14, 2008 9:46 AM

Answers

  • Here you use aggregation, so we can't talk here about inheritance. You can derive class2 from class1: in this case you will have property Top in class2.

     

    Monday, April 14, 2008 12:53 PM