Loading…

What is class?

Class is a user-defined datatype that contains variables, properties, and methods. It defines properties of an Object

Example

                                        
class Person{

    public $name;

    function __construct($name){

        $this->name = $name;

    }

    function getUserDetails(){

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

    }

}

Suggest An Answer

No suggestions avaliable!

Latest post from oops interview questions

Ask Question