2 replies to this topic
Posted 25 February 2014 - 03:52 AM
When I follow the instructions on this page, I still get errors, namely:
xxx cannot implement an interface member because it is not public
I thought the default value of methods and attributes was public? I set them as public and it removed the error.
'Bee.AlertLevel.get' must declare a body because it is not marked abstract or extern. Automatically implemented properties must define both get and set accessors
Adding the set accessor to Bee.cs fixes this but is there a reason why this isn't in the book? (p.273 only has "get" accessor for AlertLevel)
Posted 25 February 2014 - 01:29 PM
If you leave off the access modifier, the member defaults to internal, not public. There's an explanation of this on page 315 (in the third edition).
And if there's only a get accessor specified in the interface, the property that implements it can either only have a public get accessory, a public get and private or internal set accessor, or public get and set.
Author, Head First C#
Building Better Software -- http://www.stellman-greene.com
Posted 26 February 2014 - 01:44 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users