In: Computer Science
The language is C++.
1. (4 pts) What is a constructor? Explain.
2. (3 pts) What is a class? Explain.
3. (3 pts) In your own words, what is a function overloading?
1).constructor : C ++ allows the objects to initialize themselves when they are created.This automatic initialization is done with the use of a constructor.It is a special type of method that has the same name as that of its class.Whenever an object of a class is created ,its constructor will be invoked and it will initialize the object.The return type for a constructor is not defined implicitly takes its class type as it return type.
1.It cannot be abstract, native and static.
2.Cannot be inherited.
3. By default, a constructor with no arguments is provided.
2). Class: A class can be defined as skeleton for an object or blueprint for an object or template for an object.It defines all the variables and methods,an object should have.Classes help us to organize our problems and accomplishes the data hiding with the help of public and private access specifiers.
3).Function overloading : A concept where two or more function contain the similar name but discrete parameters.Due to employment of function overloading reuse of code is possible.