|Ada 95 Quality and Style Guide||Chapter 3|
- Include a prefix like New, Make, or Create in naming constructors (in this sense, operations to create and/or initialize an object).
- Use names indicative of their content for child packages containing constructors.
- Name a child package containing constructors <whatever>.Constructor.
examplefunction Make_Square (Center : Cartesian_Coordinates; Side : Positive) return Square;
Including a word like New, Make, or Create in a constructor name makes its purpose clear. You may want to restrict the use of the prefix New to constructors that return an access value because the prefix suggests the internal use of an allocator.
Putting all constructors in a child package, even when they return access values, is a useful organizational principle.
For information regarding the use of Ada constructors, refer to Guideline 9.3.3.
|< Previous Page||Search||Contents||Index||Next Page >|