Overloading is a really useful feature of some object-oriented programming languages. However, no tuti OO languages support it, and some of the "implementing" or so limited or different. In general, functions or methods, overloading allows you to create two or more functions / methods that have the same name but accept different parameters, for example:
Articles Tagged 'OO'
Overloading
Classes, Objects and Instances
I noticed often confusion when it comes to classes, objects and instances. Who is not particularly educated on object-oriented programming often confuses the true meaning of these terms. I knew, however, that there are two schools of thought regarding the definition of Class and Object. I like the "school" that indicates the class definition as a possible subject, and thus the object as instance of the class.
It sounds simple, but it happened to me - talking with others - to be in "conflict" (so to speak) and then fall into confusion, when using these terms, if anything, starting from the premise that "the other" just as we intend them .
I see it in this way, a class is a definition! Is precisely defined class of possible objects. The class is the set of methods and properties (if you want we can also add events - what else ... not only that special methods) that will own the object.
For example, when we write in Actionscript, or any other object-oriented language:
1 2 3 4 | class MyClass { MiaClass function () {} function myMethod () {} } |
We have defined a class and not an object. In the limit we have "defined" a "possible" object. We could even argue, and rightly, that the object exists at runtime while Class not (in truth there are dynamic classes that can be defined - and then used to create objects - even at runtime). Exclude static classes, of course, that - eventually - are nothing more than sub-instances (or instances hidden) and real objects.
But when we:
1 | MiaClasse = new MiaClasse ( ) ; var MyObject: MyClass = new MyClass (); |
! Here mioOggetto is an instance of MiaClasse() ! . That mioOggetto is a subject - in fact - of type MiaClasse() .
. Consequently, their philosophy to objects, objects of type MiaClasse() I can have as many as I want, something that can not be - the very definition - of MiaClasse() . For example, if it is worth and it makes sense to the report:
1 2 3 4 5 | MiaClasse = new MiaClasse ( ) ; var mioOggetto_1: MyClass = new MyClass (); MiaClasse = new MiaClasse ( ) ; var mioOggetto_2: MyClass = new MyClass (); MiaClasse = new MiaClasse ( ) ; var mioOggetto_3: MyClass = new MyClass (); ... MiaClasse = new MiaClasse ( ) ; var mioOggetto_n: MyClass = new MyClass (); |
It makes no sense:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | class MyClass { MiaClass function () {} MioMetodo_2 function () {} } class MyClass { MiaClass function () {} MioMetodo_2 function () {} } class MyClass { MiaClass function () {} MioMetodo_3 function () {} } |
Object Instance and, therefore, coincide and are used alternately for the same meaning in different contexts.
Probably not much care about anyone ... the question needs to be complete ... ![]()
Write good OO code in Adobe Flash
Here are some tips on how to write good code Object Oriented (OO) in Adobe Flash, especially for those still using version MX waiting to move to CS3.
Organize classes folders
First of all the organization of the classes makes the job of code maintenance extremely more simple. You can also create a real library you can reuse in other projects. Flash uses a nomenclature related to the filesystem, then organize them into folders will also be reflected on the import of classes. For example, if we create the sequence of folders "mylibrary / graphics / plot" and insert our own ActionScript class "PlotClass.as" when we are going to import the class we should use:
1 | grafica . plot . PlotClass ; import mylibrary. graphics. plot. PlotClass; |
If the library (folder) "mylibrary" is not in your movie folder or project, use the Flash publish settings to select the path:







Latest Comments
Mark : Thank you very much, I've lit
I solved it by setting [cc_objc] / / OptionViewController.m - ...
Giovambattista Fazioli : @ Mark: I suggest you think a more correct approach. If you run the subclass of the tab ...
Mark : Excuse the spam .. I noticed that there is an error .. here is the correction [cc_objc] / PrimaClasse.h ** ** / # import ...
Marco : forgotten .. in [cci] OptionViewController [/ cci] for [cci] @ syntetize [/ cci] I put the delegate
louis : very clear and simple I have to admit that writing a pa hardly use delegates created by ...