New topic: Don't Understand Scope
<http://forums.realsoftware.com/viewtopic.php?t=29196> Page 1 of 1 [ 2 posts ] Previous topic | Next topic Author Message Janey Post subject: Don't Understand ScopePosted: Thu Jul 23, 2009 3:51 pm Joined: Thu Jul 23, 2009 3:20 pm Posts: 1 I subclassed textareafield and added a new property. When I make an instance of this class I can only access the new property in the instance if I set its scope to public. If I set it to anything else I can only access the new property in the class definition. So if you have a user added property of a class and you want to access it in the instance of that class it has to be public? Top pregan Post subject: Re: Don't Understand ScopePosted: Thu Jul 23, 2009 4:09 pm Joined: Fri Sep 30, 2005 9:16 am Posts: 437 Location: Boston, MA, USA Quote:So if you have a user added property of a class and you want to access it in the instance of that class it has to be public? Yes and no. Public means the class property is accessible both inside and outside of the class. Protected means the class property is accessible from only inside the class itself and any subclasses you create (like say if you subclassed your already subclassed TextArea); nothing access that property from outside when it is Protected. Private means the class property is accessible only within the class itself and not any of the subclasses you create from that class. _________________ "What have you tried so far?" Philip Regan - Oatmeal and Coffee - http://www.oatmealandcoffee.com RB2K8r5.1, Mac OS 10.5, Intel, Mac-centric development Treasurer - Association of REALBasic Professionals - http://www.arbp.org Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 2 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
