Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Instace of an object

Status
Not open for further replies.

be12dune09a

Programmer
Nov 17, 2005
24
RO
Please don't send me to the perl manual,just explain if you can.How can I make in static member of a class in the object oriented way static, and how can I make a particular member of a class in the object oriented way particular like in java.Please code exemple Please.
package Me;
my $myself; # a particular member?

package You;
$you # a static member?

or

package You;
You::$you # a static member?
 
Hi,

The way to do this is by declaring a variable at the top of the file containing the package, like this:
Code:
package You;

my $variable; # a static, or class, variable
I know that the documentation is hard to get to grips with initially but it's well worth the effort. People aren't trying to be unhelpful when they point you to the documentation - honestly. *smile*

The use of static data, called Class Data in Perl, is documented in Tom's Object Oriented Tutorial which is perltoot in your browser or perldoc perltoot when you're at the command line. On the web it's available at

Mike

I am not inscrutable. [orientalbow]

Want great answers to your Tek-Tips questions? Have a look at faq219-2884
 
Yes I read that but if that is right then how can I make a member of the class that is the property of an object(instance of the class) not for all the objects.????
 
That's in there as well.

Read the section entitled "Accessing Class Data"


Mike

I am not inscrutable. [orientalbow]

Want great answers to your Tek-Tips questions? Have a look at faq219-2884

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top