In C++ you can overload constructors, so you can define multiple constructors as well.
Having constructor procedures as in EIFFEL has the advantage, that you can define different constructors having the same signature (i.e. same number and type of arguments).
Just imagine a Triangle class: You might want to construct a triangle by giving the lengths of the three sides (three float values), or by giving two sides and the enclosing angle (also three float values).
In C++ you would have to define an additional parameter (e.g. a enum value for the 'construction mode'), in EIFFEL you can simply define two construction procedures with different names.
In C++ you can overload constructors, so you can define multiple constructors as well.
Having constructor procedures as in EIFFEL has the advantage, that you can define different constructors having the same signature (i.e. same number and type of arguments).
Just imagine a
Triangle
class: You might want to construct a triangle by giving the lengths of the three sides (three float values), or by giving two sides and the enclosing angle (also three float values).In C++ you would have to define an additional parameter (e.g. a enum value for the 'construction mode'), in EIFFEL you can simply define two construction procedures with different names.