Difference

User Generated

hznve1994

Programming

Description

What is the difference between constructor and method in OOP?

User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer


A constructor has no explicit return type,It is not implicitly inherited and it usually has different rules for scope modifiers.
Constructor will be automatically invoked when an object is created whereas method has to be called explicitly.
Constructor name should match with that of class


Anonymous
Great! 10/10 would recommend using Studypool to help you study.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4