Ada 95 Quality and Style Guide | Chapter 3 |
3.2.8 Constructorsguideline
- 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.
instantiation
- Name a child package containing constructors <whatever>.Constructor.
example
function Make_Square (Center : Cartesian_Coordinates; Side : Positive) return Square;rationale
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 > |
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
TOC | TOC | TOC | TOC | TOC | TOC | TOC | TOC | TOC | TOC | TOC |
Appendix | References | Bibliography |