Quote:
Originally Posted by shah123
1. Why needed to constructor
To initialize the member variables
Quote:
Originally Posted by shah123
2. Why we define array in class and initialize in Constructor?
Thats what the task of the constructor is.
Quote:
Originally Posted by shah123
3. Why we pass paramreters and assign to local variables what we think when we do that?
To initialize the members with the values we have from the external functions (where we are creating the object).

I guess you need some more info about the constructors and I will provide them for you.

In OOP, a constructor in a class is a special block of statements called when an object is created, either when it is declared. A constructor is similar to a class method, but it differs from a method in that it never has an explicit return type, it's not inherited, and usually has different rules for modifiers. Constructors are often distinguished by having the same name as the declaring class. Their responsibility is to pre-define the object's data members.