This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

__property keyword support in GCC


Should I ask anyone, whether GCC will support Borland C++ Builder's
__property keyword and the all behind it? It is very useful thing, mainly
in the class encapsulation. For those, who aren't in touch with BC++
Builder, i wrote small example:

imagine class:
class cStatistics
       {
        float **Data;

        public:
        float Average();             // computing average of stat set
        void Centrify (float);       // centering stat set to new mean
                                     // average
        ...
       };

if you want to make something with cStatistics, you have to
declare i.e.:
 cStatistics *A = new cStatistics ();
 float AVERAGE = A->Average();  // to get average of set...
 A->Centrify (73);              // if you want to set the mean average to 73

More ellegant way is to make it through properties:
the same class:
class cStatistics
       {
        ...
        public:
        __property Avg = { read = Average, write = Centrify };

        float Average ();
        void Centrify (float);
        ...
       };

an equivalent code to the one published above:
 cStatistics *A = new cStatistics (...);
 float AVERAGE = A->Avg;  // without () - treat as variable, it will call
                          // cStatistics::Average() and the result will be
                          // passed to read part of the property
                          // function result will be presented outside class
                          // as a class' variable
 A->Avg = 3;              // this will call Centrify(float) with argument 3
                          // altering property variable will call another f()
                          

So, I would like to see something similar in GCC ;)

Bye and thanks in advance :)

                                          Peter Skvarenina


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]