On 29/06/2010 12:32, Jonathan M Davis wrote:
So, there certainly won't be any restriction on
having a getter or setter in a class if an interface it implements declared only
one. It's just that you'll only be able to use the one that's part of the
interface if you're using a reference of the interface type rather than the
implementing class.

Hi Jonathan,
interesting : this snippet compiles.

interface IBindingList {
                
        @property bool AllowEdit();


class A : IBindingList {
        private bool _allowEdit;

        @property {
                bool AllowEdit() { return _allowEdit;   }
                bool AllowEdit(bool enable) { return _allowEdit = enable; }
        }       
}

But this one NOT.

interface IBindingList {
                
        @property bool AllowEdit();
        @property bool AllowEdit(bool enable);
}
class A : IBindingList {
        private bool _allowEdit;

        @property {
                bool AllowEdit() { return _allowEdit;   }
        }       
}
IMO this is bad design.
bjoern

Reply via email to