![]() |
Constructor Question?
Hi,
I am going to ask a question which is small bit silly but for me not as i want to grasp this information in mind. The question is i have seen samples of different codes which have as following Code:
Class A1. Why needed to constructor 2. Why we define array in class and initialize in Constructor? Code:
Class B3. Why we pass paramreters and assign to local variables what we think when we do that? Can you please answer my questions in nice way instead of being angry on my silly questions.I want to undertand this concept fully when to do or not to do like this? Thanks, Regds, |
Re: Constructor Question?
Quote:
Quote:
Quote:
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. |
Re: Constructor Question?
Thanks Shabbir. Thanks a million
|
| All times are GMT +5.5. The time now is 16:15. |