comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Are user-defined private methods possible?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Are user-defined private methods possible? [message #67198 is a reply to message #67172] Wed, 08 July 2009 12:17 Go to previous messageGo to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
F�LDY Lajos wrote:
>
> On Wed, 8 Jul 2009, Paul van Delst wrote:
>
>> As the subject states, are user-defined private methods possible in IDL?
>>
>> I have some object methods that I want to be private to the class
>> (like Init and Cleanup) but I can't find any info on how to do that in
>> the IDL help. Once the methods in question are invoked (and, thus,
>> compiled) in a public method, they're accessible from outside the class.
>
> You can not prevent calls to your "private" methods, but you can check
> whether the caller is a method of your class or not:
>
> ; cut here, copy to test.pro and .ru test
> ;
> pro o::private
> catch, stranger
> if stranger ne 0 then $
> begin
> catch, /cancel
> goto, prn
> endif
>
> if not obj_isa((scope_varfetch('self', level=-1)), 'o') then stranger=1
>
> prn:
> if stranger ne 0 then print, 'private call failed' $
> else print, 'private call succeeded'
> end
>
>
> pro o::public
> self->private
> end
>
>
> s={o, i:0}
> o=obj_new('o')
> print, 'calling private from class method:'
> o->public
> print, 'calling private directly:'
> o->private
> end
>
> ; cut here

schweet! I'll see if I can put this code in my error handler include file for use....

Thanks,

paulv
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: nike clothing,nike shoes,online store,http://www.nbashoe.com air Jordan Shoes,Nike Air Jordans, Air Force Ones,Retro Air Jordan, Bape Hoodies,Bape shoes-Tencent Traveler|Jordan Shoes,Nike Air Jordans, Air Force Ones,Retro Air Jordan, Bape Hoodie
Next Topic: Re: Question about user input in IDL

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 03:40:39 PDT 2025

Total time taken to generate the page: 1.44009 seconds