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

Home » Public Forums » archive » Call a method from a class
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Call a method from a class [message #47588] Wed, 15 February 2006 11:25 Go to next message
vcarlos is currently offline  vcarlos
Messages: 21
Registered: February 2006
Junior Member
Hi all,

In some languages is possible to call methods from a Class, instead of
a object. For instance, the class Messager could call a method
reportError, message. This is useful when I just need a "instance" of
that object and everybody takes advantage of that (I think that is
similar to Singleton design pattern). Is there any way to the same in
IDL? Or I should set up some kind of library procedures/functions and
use through my program?

Thanks a lot

Vinicius
Re: Call a method from a class [message #48146 is a reply to message #47588] Sat, 01 April 2006 01:24 Go to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
vcarlos wrote:
> In some languages is possible to call methods from a Class, instead of
> a object. For instance, the class Messager could call a method
> reportError, message. This is useful when I just need a "instance" of
> that object and everybody takes advantage of that (I think that is
> similar to Singleton design pattern). Is there any way to the same in
> IDL? Or I should set up some kind of library procedures/functions and
> use through my program?

IDL doesn't provide you with a lot of extra syntax/features for
object-oriented programming, but you can get around most of what's
missing with good conventions and discipline.

For class methods, I usually just use the name of the class as a prefix
to a normal routine name. So for example, the class method sin of the
Math class would be:

function math__sin, x

The hard part is figuring out where to put it. I normally put my method
definitions and the member variable definition all in one file. If you
put the class method definitions in there too you have to instantiate an
object of that class in order to call them. So I usually put them in
their own files.

Class variables are a bit trickier, I usually use a COMMON block with a
special name defined in the math__define routine.

-Mike
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Today's Content Quality Rating For comp.lang.idl-pvwave
Next Topic: having a routine .compile something?

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

Current Time: Fri Oct 10 06:14:44 PDT 2025

Total time taken to generate the page: 1.12206 seconds