Perl : Object oriented way.. few basics

An object is a thing that provides access to or modification of data.

A class is a description of the attributes of a particular kind of object and the manner in which those objects can be accessed and modified.

A method is a means by which an object’s data is accessed or modified.

An object is an instance of a class.

Object-oriented programming sometimes involves inheritance. Inheritance simply means allowing one class called the Child to inherit methods and attributes from another, called the Parent, so you don’t have to write the same code again and again.

Concept of using the methods of an existing object and modifying them is known as polymorphism.

A reference is, exactly as the name suggests, a reference or pointer to another object.

There are two types of references: symbolic and hard.

A symbolic reference enables you to refer to a variable by name, using the value of another variable. For example, if the variable $foo contains the string “bar”, the symbolic reference to $foo refers to the variable $bar.

A hard reference refers to the actual data contained in a data structure.

The unary backslash operator is used to create a reference to a named variable or subroutine.

For example: $foo = ‘bill’ ;

$fooref = \$foo ;

Now $fooref variable contains a hard reference to $foo variable.

A reference is always a scalar variable and it can be referencing to any of scalar,array or hash variable.

Advertisements

Tags: , , , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: