IDL Object Programming

zhaozj2021-02-16  86

IDL supports object-oriented programming, but is incomplete, not supporting the visibility of members.

You can define the IDL class by defining a separate file. It is easier to manage, the way the definition is: Pro __ define struct = {, ...} End file name is: __ define.pro in this In the file, you can also add the definition of the class member function, such as: Pro :: Hello ... EndIDL is not case sensitive, so class name / function name / keyword, etc., can not be limited to case-write limit IDL pair Category provides some special member functions, complete dedicated tasks. For example, init is constructor, cleanup is a destructor (call when the object is released, such as an Obj_Destroy function). But these functions cannot be called outside, but can be The function is inside, mainly for manual calls to implement the initialization function of the parent class (IDL does not automatically call the parent class INIT function)

The INIT function can be used with parameters, which can be incorporated when calling the OBJ_NEW to generate an object. The invocation form of the OBJ_NEW function is as follows: result = obj_new ([ObjectClassName [, arg1 ...... Argn]])

IDL's function and process parameters may be incomplete, such as 5 parameters, which can be called with 0-5 parameters. Use n_params and n_lements with n_params and n_lements to be judged by N_PARAMS and N_EMENTS, the former can get the actual call parameters Number, the latter can determine if a parameter is valued in sub test :: init, caption print, n_params (); returns a number of parameters participating in the call, n_lements (caption); return 1 is value, return 2 is not Definition ... END

You can define multiple symbols, but only the one defined is valid, the front will be hidden.

转载请注明原文地址:https://www.9cbs.com/read-11794.html

New Post(0)