• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Well, I'm Confused...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Well, I'm Confused...


  • Subject: Re: Well, I'm Confused...
  • From: Paul Berkowitz <email@hidden>
  • Date: Tue, 27 Apr 2004 13:10:40 -0700

On 4/27/04 12:00 PM, "email@hidden" <email@hidden> wrote:

> I thought both values should be "Child Value", since the Child's property
> overrides the Parent's property. Silly me.
>
> What am I missing?
>
> script theParent
> property zzz : "Parent Value"
> on send()
> return zzz
> end send
> end script
>
> on makechild()
> script theChild
> property parent : theParent
> property zzz : "Child Value"
> return (theChild)
> end script
> end makechild
>
> set theChild to makechild()
> {theChild's zzz, theChild's send()}
>
> --> {"Child Value", "Parent Value"}

First, if you're trying to use makechild() as a constructor, as I think you
are, the final 'return' line should be outside the theChild script object.

on makechild()
script theChild
property parent : theParent
property zzz : "Child Value"
end script
return (theChild)
end makechild


But telling theChild to send() will still use theParent's zzz, since send()
is defined only in theParent. To do what you want, you'd have to do it this
way:


script theParent
property zzz : "Parent Value"
on send(X)
return X
end send
end script

on makechild()
script theChild
property parent : theParent
property zzz : "Child Value"
end script
return (theChild)
end makechild

set theChild to makechild()

tell theChild to send(its zzz)
--> "Child Value"




--
Paul Berkowitz

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


  • Prev by Date: Re: UNIX DATE
  • Next by Date: Re: Posting to a USENET Newsgroup in an Applescript?
  • Previous by thread: Well, I'm Confused...
  • Next by thread: Re: Well, I'm Confused...
  • Index(es):
    • Date
    • Thread