en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en de en en en en nl en en en en en de en ceb en en en en en en ceb en en en en en ceb en en en en ceb en en en en ceb it en ceb en en en en en en en en ceb ceb zh en en en en en en en en en de en en de en en en en en nl en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en de en en en fr en en en en en en en en en pt en en en en en en
By logging into your account, you agree to our Privacy Policy, personal data processing and storage practices as described therein.
Forgot password or user name?
Search in titles only Search in Working with Objects only
You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
All Time Today Last Week Last Month
All Discussions only Photos only Videos only Links only Polls only Events only
####################### OBJECT and Class Definition #############################################
++ Object (UML like structure) ++| +++++++++ CLASS (PB – structure and syntax) ++++++++++++++++++
===========NAME=============== | ==CLASS name [$GUID] [AS COM | AS EVENT]========================================================================
| Class Method code blocks...
| [CLASS|OVERRIDE] METHOD name_class_level [ ] [ALIAS "altname"] (var AS type...) [AS type]
| METHOD = expression
========ATTRIBUTES============ | ======INSTANCE attribute AS type ===============================================================================
- - action on generation - -| CLASS METHOD CREATE()
| METHOD = expression
- - action on destruction - | CLASS METHOD Destroy()
| METHOD = expression
-----------interface-----------| INTERFACE interfacename [$GUID] [AS EVENT] [AS HIDDEN]
- - - -inheritance- - - -| INHERIT IUNKNOWN
OR | INHERIT IDISPATCH ' only one INHERITANCE per CLASS
- - - - new - - - - |
- - - common action - - - | [CLASS|OVERRIDE] METHOD name_interface_level [ ] [ALIAS "altname"] (var AS type...) [AS type]
| METHOD = expression
| [OVERRIDE] PROPERTY GET|SET name_interface_level [ ] [ALIAS "altname"] (var AS type...) [AS type]
| PROPERTY = expression
----------#######----------- | END INTERFACE
The projection of OBJECT-NAME and CLASS-NAME, ATTRIBUTES and INSTANCES, and ACTIONS and METHODS are obvious. However, I found in the handbook indication that PB differentiates between METHODS on the class_LEVEL (syntactic position above the INSTANCE definition) and METHODS on the interface_LEVEL. The later are used in combination with the INTERFACE and can be accessed from the outside of the CLASS. The variables (ATTRIBUTES) used in the interface_LEVEL METHODS are defined as INSTANCES.
QUESTION: How are the variables defined/declared for the class_LEVEL METHODS located above the INSTANCE block ?
QUESTION: How are the class_LEVEL METHODS accessed/called inside of the CLASS (any examples ?) ?
QUESTION: Are there any relevant limitation of number, size or type of variables transferred through a METHOD command ?
INHERITANCE implies a hierarchical structure from great grand father/mother to great grand son/daughter. The handbook of PB does not mention such limitation.
QUESTION: If no hierarchical structure is required for the PB INHERITANCE, can we combine CLASSES with a circular referencing INHERITANCE ?
QUESTION: What types of errors can occur if an unlimited circular referencing of CLASSES occurs ?
Thank you for suggestions and replies
Last edited by Andreas Kage; 17 Nov 2008, 05:32 PM. Reason: correction of formatting
Join Date: Mar 2004
17 Nov 2008, 06:21 PM
QUESTION: How are the variables defined/declared for the class_LEVEL METHODS located above the INSTANCE block ?
INSTANCE variables must be located ABOVE anything else, just below CLASS. There are not instance variables for class methods and instance variables for the rest.
QUESTION: Are there any relevant limitation of number, size or type of variables transferred through a METHOD command ?
Maximum number of parameters: 32. The same that for standard procedures.
Type of variables: For IUnknwon interfaces, the same that for standard procedures, excepting you can't pass an array descriptor. For IAutomation and IDispatch interfaces, only automation compatible types: BYTE, WORD, DWORD, INTEGER, LONG, QUAD, SINGLE, DOUBLE, CURRENCY, OBJECT, STRING, and VARIANT.
QUESTION: How are the class_LEVEL METHODS accessed/called inside of the CLASS (any examples ?) ?
From the help file:
What is a Class Method?
A CLASS METHOD is one which is private to the class in which it is located. That is, it may only be called from a METHOD or PROPERTY in the same class. It is invisible elsewhere. The CLASS METHOD must be located within a CLASS block, but outside of any INTERFACE blocks. This shows it is a direct member of the class, rather than a member of an interface.
INSTANCE MyVar AS LONG
CLASS METHOD MyClassMethod(BYVAL param AS LONG) AS STRING
METHOD = "My" + STR$(param + MyVar)
In the above example, MyClassMethod() is a CLASS METHOD, and is always accessed using the pseudo-object ME (in this case ME.MyClassMethod). Class methods are never accessible from outside a class, nor are they ever described or published in a type library. By definition, there is no reason to have a private PROPERTY, so PowerBASIC does not offer a CLASS PROPERTY structure.
Regarding circular reference, it must be avoided by all means. If class A holds a reference to class B, and class B holds a reference to class A, neither A nor B will never be destroyed.
Copyright © 1998-2022 PowerBASIC Tools, LLC - All Rights Reserved.
Powered by vBulletin® Version 5.7.0
Copyright © 2022 vBulletin Solutions, Inc. All rights reserved.
All times are GMT-5. This page was generated at 09:10 PM.
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.