is having two methods in a class permissible? why?
explain the purpose of a constructor and the implication of having two in one class.
1
Expert's answer
2012-04-26T07:36:55-0400
Methods may be several. The method in object-oriented programming - it is a function or procedure, belonging to any class or object. In object-oriented programming class constructor - a special block of instructions is called when an object is created. The constructor method is similar to but different from the method that does not explicitly defined the return type is not inherited, and usually has different rules for consideration of modifiers. Constructors are often distinguished by having the same name as the class name, which is declared. Their task - to initialize the members of the object
Comments
Leave a comment