PHP Constructor and Destructor

If the user wants to access any member function of a class then he or she must create the object first then call the member function by this object. The constructor is a method or way which automatically called when an object the for a class. No need to call it by an object. Simply constructor is a … Read more

Constructors in Java- Type Overloading and examples

A Constructor in a special method that is used to initialize the object. Constructor name should be same as class name. Constructors does not have any return type. public class Student(){ //constructor Student(){ } } While creating object of above class we use Student student=new Studet() Here new is used to create object and after … Read more