Le 30/04/2013 05:05, Ian Haywood a écrit : > On 30/04/13 00:34, Benoît Minisini wrote: > >> If theses twwo arguments must be handled differently between classes, >> then add a public method to handle them. Prefix its name with an >> underscore, to indicate that it must not be called outside of the >> implementation. >> >> ' Root class >> Public Sub _new(Source as String[], Name as String) >> _Init(Source, Name) >> End >> >> ' Any child class >> Public Sub _Init(Source as String[], Name as String) > This is rule around underscores enforced by the compiler (a la Python) > or only a convention?
It's a convention used everywhere in the Gambas source code. > > would you consider a Protected access type (like C++) instead? > > Ian > No, I always explained that in a previous mail (don't remember which one). I prefer using a convention, to prevent confusion on what really happens in the background (and keep simplicity). "protected" in C++ is a convention enforced by the compiler, but it's still a public method, i.e. a method that can be called outside of a class (even if it is a child class). I often saw C++ programmers that do not understand how all that klingon object-oriented syntax is implemented in the background. In Gambas, the syntax is far more... basic, but what happens is more clear (you just can be "public" or "private"). Regards, -- Benoît Minisini ------------------------------------------------------------------------------ Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET Get 100% visibility into your production application - at no cost. Code-level diagnostics for performance bottlenecks with <2% overhead Download for free and get started troubleshooting in minutes. http://p.sf.net/sfu/appdyn_d2d_ap1 _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user