Constructor (object-oriented programming): Difference between revisions

Content deleted Content added
m clean up; http->https (see this RfC) using AWB
No edit summary
Line 81:
== Syntax ==
 
* [[Java (programming language)|Java]], [[C++]], [[C Sharp (programming language)|C#]], [[ActionScript]], and {{nowrap|[[PHP]] 4}} have a naming convention in which constructors have the same name as the class ofwith which they are associated with.
* In PHP 5, a recommended name for a constructor is <code>__construct</code>. For backwards compatibility, a method with the same name as the class will be called if <code>__construct</code> method can not be found. Since PHP 5.3.3, this works only for non-namespaced classes.<ref name="php5cpnstructor">[http://www.php.net/manual/en/language.oop5.decon.php Constructors and Destructors], from PHP online documentation</ref>
* In [[Perl]], constructors are, by convention, named "new" and have to do a fair amount of object creation.