Welcome! Log In Create A New Profile

Advanced

Binod Lohani: Declaring the class and its elements

Posted by harvey68 
Binod Lohani: Declaring the class and its elements
September 08, 2018 05:17PM
Autor: Binod Lohani

Link zum Beitrag: [27130.foren.mysnip.de]

I am trying to understand Class in Windev.

I guess I understand the Meaning of PUBLIC, PROTECTED and PRIVATE.

But didn't know When to put or not to put GLOBAL in front of them .

For Example
What would be the difference between these Two ?

GLOBAL PRIVATE

PRIVATE
___________________________________
or these two??

PRIVATE CONSTANT

GLOBAL PRIVATE CONSTANT
Fabrice Harari: Declaring the class and its elements
September 08, 2018 05:19PM
Autor: Fabrice Harari

Link zum Beitrag: [27130.foren.mysnip.de]

Hi

GLOBAL means that you have only ONE instance of that 'thing' in memory,
and it's there all the time, EVEN if you DON'T instantiate an object of
the class...

By example, if you do

Global
iNumberOfObjects is int

You just created a counter in which you can know the number of objects
of that class instantiated at any given time.. Just do

iNumberOfObject++ in the constructor

and iNumberOfObjects-- in the desctructor of your class,

then, from anywhere in your program (even the first line of code of the
project), you can do:
info(NameofCLASS::iNumberOfObjects)

the difference in USING global variable or methods is that you don't do
: NameOfObject:iNumberOFObject, but NAMEOFCLASS::iNUmberOfObject (as
this exist OUTSIDE of the instantiation of any object)

This is great to use as internal maintenance tools (keep an array of
existing objects to debug any memory leak, garbage disposal, etc)

Everything else (private/publoc,etc...) is INSIDE an instantiated
object.

Very powerful stuff

Best regards
Binod Lohani: Declaring the class and its elements
September 08, 2018 05:20PM
Autor: Binod Lohani

Link zum Beitrag: [27130.foren.mysnip.de]

Thanks Fabrice !
So There is nothing like GLOBAL PRIVATE or Like GLOBAL PUBLIC When
declaring Class ??

Thanks Again ??
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: