You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! Thanks for posting this. You're right, BelongsToPack is a concrete method, because abstract classes can contain concrete methods. (Here's the reference for that – 14.2.2.2 Abstract Classes – "An abstract class is permitted (but not required) to contain abstract members.")
But then the code wouldn't compile, because the = false; makes it an auto-implemented property, which must be concrete.
So while the book is technically correct, we definitely could do a better job teaching this part! I'm going to have to think about how to handle this—teaching about abstract classes well is challenging, so it's going to take some work to improve this, but I'm definitely going to try! We're working on the 5th edition now (targeting the next version of C#, which will probably be released in November 2023). I'll leave this issue open to track that.
say it has its own abstract property, BelongsToPack, but why abstract modifier didn't appear before BelongsToPack ,Thanks
The text was updated successfully, but these errors were encountered: