IonicWind Software

Aurora Compiler => General Discussion => Topic started by: Bruce Peaslee on January 03, 2006, 09:13:08 AM

Title: Public/Private class variables/methods
Post by: Bruce Peaslee on January 03, 2006, 09:13:08 AM
What is the thinking on Public and Private member variables and methods?
Title: Re: Public/Private class variables/methods
Post by: Ionic Wind Support Team on January 03, 2006, 09:24:30 AM
C++ uses private, protected and pubic variables and methods.  It's a way of controlling access.

Public variables and methods are accessable outside of the class, such as in the 'main' subroutine or by another class that has a pointer to the class in question.

Protected variables and methods are only accessable by code in that class, or any derived class.  In other words a class method can access the variable but no other class or global function can.  The idea is there are variables you don't want accessed outside of your class.

Private variables and methods are only accessable by the base class they are defined in.  Derived classes don't have access.

Paul.
Title: Re: Public/Private class variables/methods
Post by: Bruce Peaslee on January 03, 2006, 10:20:51 AM
Will these concepts be used in Aurora?
Title: Re: Public/Private class variables/methods
Post by: Ionic Wind Support Team on January 03, 2006, 11:27:18 AM
Perhaps.  Still debating on it.

It does help when your sharing code libraries and don't want users mucking about in the internals.
Title: Re: Public/Private class variables/methods
Post by: Parker on January 03, 2006, 02:58:04 PM
In my opinion, adding features can never hurt, of course it could be a low priority item. If you don't want to use them you don't have to. But if you do want that extra safety of knowing other people won't modify your classes, then you can.
Title: Re: Public/Private class variables/methods
Post by: Zen on January 04, 2006, 09:09:31 AM
Yes i think it is a good idea to have them for sharing statics, there is always someone who will encounter a problem either acciedntly or on purpose. So like Parker said, a little bit of extra safety.

So i guess i wouldnt mind this being added later on.

Lewis