Jump to content

Talk:Constructor (object-oriented programming)

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 195.143.217.186 (talk) at 09:54, 17 October 2005 (Constructors are operations, not methods). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Is a constructor really a method? I'd rather propose to say: a constructor is an operation AND a method is an operation, too. I.E. a method may have different return types whereas a constructor's return type should be clear. You might define a constructor as a special method with a constraint about its return type but defining them as different metaclasses seems to be a better (and proper) solution.