Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Repeated class name
Message
From
29/11/2003 08:01:58
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Java
Category:
Other
Miscellaneous
Thread ID:
00854350
Message ID:
00854417
Views:
25
OK, thanks for the explanation.

>Hi Hilmar,
>
>Here is an explanation from a perl point of view. Yes, perl does Oops. The only problems is that the perl user usually must write the base classes he will use.
>
>A class is code that can provide properties, events, and methods. A method is a subroutine, (procedure in VFP), built into a class or object. A method gets an object reference or class name passed to it as its first argument ( eg thisform.do_method() )
>
>An object is a referenced item that, unlike other references, konws what class it's part of. You create objects from classes.
>
>Inheritance is a process of deriving one class, called the derived class, from another, the base class, and being able to make use of the base class's properties, events, and methods in the derived class.
>
>Your code is creating a object from a base class. The object create (e.g. b) is simply a reference back to the base class so that you can reference the properties, events, and methods in the base class through the newly created object b.
>
>In Perl, you call an object an instance of a class, and the object's subroutines "instance methods', or 'member functions', or just 'methods'. Beside built-in subroutines, you can also store data items in objects, and such items are called 'data members' or 'instance data'. Data items common to all members of a class are called 'class data'.
>
>The following would create a simple class and constructor in perl. Constructors usually have the name new, so I create a subroutine with that name:
>
>In that subroutine, I'll need something to bless and return as the basis of this object, and in perl, you usually use an anonymous hash for that. You can store data members in this hash. The hash is named $self.
>
>
>
>#!/usr/bin/perl -w
>
>package Class1;
>
>sub new
>{
>   My $self = {};
>
>   bless($self);
>
>   return $self;
>
>}
>
>return 1
>
>
>Now I can create an object from the above class. To create the new object from the class, I call the class's constructor, which returns a reference to the new object.
>
>
>
>my $object = Class1->new();
>
>
>
>Now I can use $object to reference back into the classes properties, events, and method, if I had included any in the class.
>
>The way perl handles Oops is not unlike the way it works in VFP, Java, C#, C++, etc. They are all much alike.
>
>Oops in perl currently dosen't provide a standard set of base classes that can be accessed through a really nice IDE, but maybe with the release of perl 6.0. <g>
>
>Regards,
>
>LelandJ
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform