realbasic-nug
[Top] [All Lists]

Re: Scope/Protection Question

To: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Subject: Re: Scope/Protection Question
From: Joe Strout <joe@inspiringapps.com>
Date: Sat, 30 May 2009 09:00:46 -0600
Authentication-results: mx.google.com; spf=neutral (google.com: 74.124.194.228 is neither permitted nor denied by best guess record for domain of realbasic-nug-bounces@lists.realsoftware.com) smtp.mail=realbasic-nug-bounces@lists.realsoftware.com
Delivered-to: listarchive@realsoftware.com
In-reply-to: <A1D4CABD-DD79-4126-8A5C-0E1E2F54993E@verizon.net>
Organization: Inspiring Applications, Inc.
References: <345AFE42-338C-4588-9F76-7560C88B8609@verizon.net> <A1D4CABD-DD79-4126-8A5C-0E1E2F54993E@verizon.net>
Reply-to: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Sender: realbasic-nug-bounces@lists.realsoftware.com
User-agent: Thunderbird 2.0.0.21 (Macintosh/20090302)
Karen wrote:

Say I have a Class1 that has a PROTECTED property Property1

Class2 Inherits From Class1
Class2 Has a property Parent as Class1

In a method on Class1 I have a method:

Sub Class1.aMethod(Parent as Class2)
  me.Property1 = Parent.Property1
End Sub

I thought I should be able to do that as i thought protected properties should be able accessed within the class and it's subclasses

I agree, you should be able to. That you can't is probably a subtle design flaw in the compiler. You can workaround it by typecasting Parent to Class1 before accessing its protected property. (Or, as you found, change the declaration of the parameter -- probably a better solution, since the base class really shouldn't be know about its subclasses.)

Best,
- Joe

--
Joe Strout
Inspiring Applications, Inc.
http://www.InspiringApps.com


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>