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

Home » Public Forums » archive » object methods as friends
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: object methods as friends [message #39165 is a reply to message #38969] Sun, 18 April 2004 15:42 Go to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
Zorch Tierod wrote:
> Hey there,
> I've got an application that uses two types of objects, each with
> several different method procedures.
>
> What I'm trying to do is to calculate some stuff based on the
> interaction of one of the objects with an array of the other type of
> objects. Illustrative example (but not the REAL application!):
>
> sb = {bullet, param1:.....} ;protoype for bullet object
> st = {target, param1:......} ;prototype for target object
>
> target_array = obj_arr('target',10) ;make a bunch of targets
> projectile = obj_new('bullet') ;make a bullet
>
> jtarget = which_hit(target_array, projectile) ;return which target is
> hit
>
> My problem seems to be that the function 'which_hit' has no access to
> the data of either the 'bullet' or the 'target' objects, because it is
> not a method of either - and I can't make it a method of both...

The standard way of dealing with this in IDL is to expose the properties
you need via GetProperty & SetProperty methods. Yes, this can be a lot
of work and, no, it doesn't allow for discrimination between friend and
non-friend callers.

I suppose you could have FriendGetProperty & FriendSetProperty methods
which asked for authentication from the caller, but really, why would
you bother? If you don't want non-friends to access certain properties,
then just don't do it.

--
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)

Add extraneous new text to keep news server happy. Add extraneous new
text to keep news server happy. Add extraneous new text to keep news
server happy. Add extraneous new text to keep news server happy. Add
extraneous new text to keep news server happy. Add extraneous new text
to keep news server happy. Add extraneous new text to keep news server
happy. Add extraneous new text to keep news server happy. Add extraneous
new text to keep news server happy. Add extraneous new text to keep news
server happy. Add extraneous new text to keep news server happy. Add
extraneous new text to keep news server happy. Add extraneous new text
to keep news server happy. Add extraneous new text to keep news server
happy. Add extraneous new text to keep news server happy. Add extraneous
new text to keep news server happy. Add extraneous new text to keep news
server happy. Add extraneous new text to keep news server happy. Add
extraneous new text to keep news server happy. Add extraneous new text
to keep news server happy. Add extraneous new text to keep news server
happy. Add extraneous new text to keep news server happy. Add extraneous
new text to keep news server happy.
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: mpeg quality
Next Topic: modal widgets problem

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

Current Time: Sat Oct 11 15:51:58 PDT 2025

Total time taken to generate the page: 1.20179 seconds