Function overloading: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 10:
In some [[object oriented]] [[programming language]]s, [[Constructor (computer science)|constructors]] can also be overloaded. In languages that require constructors to have the same name as the declaring [[class (computer science)|class]], constructor overloading allows multiple ways of creating an object. The constructors must have different parameter types and numbers of [[parameter (computer science)|parameters]].
 
For example, the example class <tt>Person<tt> below, written in [[Java (programming language)|Java]], holds data about each person's name and phone number. The constructor is ''overloaded'' as there are two constructors for the class <tt>Person<tt>.
 
<source lang="java">