简体   繁体   中英

Confused: Abstract Class Properties

Abstract class, contains property:

private Box padding_;
public Box Padding
{
    get { return padding_; }
    set {
        padding_ = value;
        Model.UpdateValues( );
    }
}

Later I update the property of an inherited class instance, property updated:

ExitButton.Padding.Top = 5f;

The code in the setter isn't being called. I'm super confused.

Nothing to do with abstract classes really. This simply doesn't call the setter for Padding :

ExitButton.Padding.Top = 5f;

It calls the getter for Padding , then calls the setter for the Top property in the Box object returned by that getter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM