tag:blogger.com,1999:blog-6977069.post108551979638677212..comments2022-10-27T11:40:01.409+02:00Comments on Hallvard's Blog: Hack #4: Access to protected methodsHallvards New Bloghttp://www.blogger.com/profile/09527199955524812466noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-6977069.post-40022842372831648022007-06-21T08:48:00.000+02:002007-06-21T08:48:00.000+02:00Alister,Indeed!I cover the relatively new strict, ...Alister,<BR/><BR/>Indeed!<BR/><BR/>I cover the relatively new strict, sealed and abstract classes and final methods here:<BR/><A HREF="http://hallvards.blogspot.com/2006/09/dn4dp2-protecting-your-privates.html" REL="nofollow">http://hallvards.blogspot.com/2006/09/dn4dp2-protecting-your-privates.html</A>Hallvards New Bloghttps://www.blogger.com/profile/09527199955524812466noreply@blogger.comtag:blogger.com,1999:blog-6977069.post-65809141447669894462007-06-21T00:01:00.000+02:002007-06-21T00:01:00.000+02:00Remember that you can also use the strict keyword....Remember that you can also use the strict keyword. strict private only allows access to methods/fields within the class, with strict protected you can only use methods/fields in descendants. Strangely there is no strict public/published ;-).<BR/>Also you can use the sealed keyword to prevent inheritance.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6977069.post-1086079372818286602004-06-01T10:42:00.000+02:002004-06-01T10:42:00.000+02:00> advocate for more proper design
hear hear!
I v...> advocate for more proper design<br /><br />hear hear!<br /><br />I very much agree with you, Petr. Maybe there needs to be a new visibility directive 'strict public', that is only available to programmers programming in advanced mode...? I'm only half-kidding.... :)Hallvards New Bloghttps://www.blogger.com/profile/09527199955524812466noreply@blogger.comtag:blogger.com,1999:blog-6977069.post-1085856985561685102004-05-29T20:56:00.000+02:002004-05-29T20:56:00.000+02:00Thanks for coming forward, David...! :)
btw, it w...Thanks for coming forward, David...! :)<br /><br />btw, it was not TeeChart and your company I was thinking about when I wrote that...Hallvards New Bloghttps://www.blogger.com/profile/09527199955524812466noreply@blogger.comtag:blogger.com,1999:blog-6977069.post-1085667976305056522004-05-27T16:26:00.000+02:002004-05-27T16:26:00.000+02:00Hallvard, I think I was implying a wish more than ...Hallvard, I think I was implying a wish more than anything. <br /><br />Plus I confused field access and method access. I could have sworn C# allowed method access from a property accessor. Apparently not :-x<br /><br />I like to rewrite a language, especially when I'm tired.Chris Dickersonhttps://www.blogger.com/profile/11671515169945749143noreply@blogger.comtag:blogger.com,1999:blog-6977069.post-1085662252637669042004-05-27T14:50:00.000+02:002004-05-27T14:50:00.000+02:00This comment has been removed by a blog administrator.Chris Dickersonhttps://www.blogger.com/profile/11671515169945749143noreply@blogger.comtag:blogger.com,1999:blog-6977069.post-1085660228611253782004-05-27T14:17:00.000+02:002004-05-27T14:17:00.000+02:00Is there a reason properties aren't used to expose...Is there a reason properties aren't used to expose protected methods and fields instead of this class hack?Chris Dickersonhttps://www.blogger.com/profile/11671515169945749143noreply@blogger.comtag:blogger.com,1999:blog-6977069.post-108566140366301122004-05-27T14:36:00.000+02:002004-05-27T14:36:00.000+02:00Not sure what you mean here, Chris?
How do you ex...Not sure what you mean here, Chris?<br /><br />How do you expose "procedure Useful;" as a property?<br /><br />As I show in the blog, if you can afford to use a instnace of a child class instead of the base class, you can promote the method by declaring a new public method with the same name, that simply forwards the call using the inherited syntax.<br /><br />Only when you cannot change the typeHallvards New Bloghttps://www.blogger.com/profile/09527199955524812466noreply@blogger.com