Category: Oops

what is encapsulation?

January 12, 2010 | Filed Under Oops | Leave a Comment

Encapsulation the ability of an object to hide its data and methods from the rest of the world. It is one of the fundamental principles of Oops.

The protection involves providing a stable interface which protects the remainder of the program from the implementation (the details that are most likely to change).

Public class Add
{
private void subtract(int x, int y)
{
return x * y;
}
}


Add obj;
int Result;
Result = obj.subtract(5,10);

Article written by urooj

what is oops?

January 12, 2010 | Filed Under Oops | Leave a Comment

Object-oriented programming is a programming paradigm that uses objects – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as information hiding, data abstraction, encapsulation, modularity, polymorphism, and inheritance.

In OOPS, we get the power to create objects of our own, as & when required. Oops is a programming methodology where each entity is an object.

Article written by urooj

How can we create a class in php?

December 26, 2009 | Filed Under Oops | Leave a Comment

Classes are the type of objects.

The class is the type of the object,and the object is an instance of the class.You normally create objects using classes,and then use those objects in your code.

Example:–
class Harry
{
var $name;
function set_name($data)
{
global $name;
$name = $data;
}
function get_name()
{
global $name;
return $name;
}
}
In php,classes are usually given names that start whit a capital letter,and objects are given names that start with a lowercase letter.

Article written by urooj

© PHPInterviewQuestion.com 2009 - 2010

eXTReMe Tracker