1.

What is Class and Objects in OOPS?

Answer»

Class

In Object-Oriented PROGRAMMING, a class is a blueprint that defines the functions and variables which are common to objects of a certain kind.

Object

In OOPS an object is a specimen of the class. It is nothing but a component that CONSISTS of methods and properties which MAKE the data useful and help users to determine the behavior of the class.

Let’s UNDERSTAND this with an exampleExample

class Person{

    public $NAME;

    function __construct($name){

        $this->name = $name;

    }

    function getUserDetails(){

        return "My name is ".$this->name;

    }

}



Discussion

No Comment Found