August 09, 2004 Re: broken override | ||||
---|---|---|---|---|
| ||||
Posted in reply to Arcane Jill | Arcane Jill wrote: > In article <cf0h6b$ob2$1@digitaldaemon.com>, Stewart Gordon says... > >>>As you will observe, A.create() is protected, and not final. Therefore, it is >>>/reasonable/ to expect that a derived class may override it. >> >>Yes, but obviously not with a private method. > > Just to make things really interesting, I added another class. Note now that A's > method is protected; B's method is private; and C's method is public: <snip> > Compiles without complaint. Yes, because within a module everything is accessible. <snip> > A fair point. In which case, it should be a compile error to declare a private > function with the same name and signature as a protected function in a base > class - either with or without the keyword "override". <snip> I entirely agree. Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit. |
Copyright © 1999-2021 by the D Language Foundation