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 #67201 is a reply to message #67199] Wed, 08 July 2009 11:56 Go to previous messageGo to previous message
Foldy Lajos is currently offline  Foldy Lajos
Messages: 268
Registered: October 2001
Senior Member
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


regards,
lajos
[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: Sat Oct 11 16:18:14 PDT 2025

Total time taken to generate the page: 0.88214 seconds