What is constructor ?
Constructors are the special member functions which have the same name as the class name. The most important thing is that they don\'t hava return type. Constructors may be overloaded. If you don\'t provide a constructor for the class, the compiler will supply the defualt one. Constructors can have any of the access modifiers. Example: public class MyClass{ int i; int j; public MyClass(){} protected MyClass(int i){} private MyClass(int i,int j){} }
Constructors are the special member functions which have the same name as the class name. The most important thing is that they don\'t hava return type. Constructors may be overloaded. If you don\'t provide a constructor for the class, the compiler will supply the defualt one. Constructors can have any of the access modifiers. Example: public class MyClass{ int i; int j; public MyClass(){} protected MyClass(int i){} private MyClass(int i,int j){} }