a constructor is a function with the same name of class in which it is defined. It doesn't have any return type and used to intialize the objects of class.
Constructor are looks like a method that has name and paranthesis bt nt actually method.. It is used to initialize variable , doesn't retrn anything and name same as the class. It is invoked automatically when a class instantiated. And explicitly called by its name and number of parameters.
No comments:
Post a Comment