Steve McConnell Quote
Example 6-11. Java Example of Enforcing a Singleton with a Private Constructor public class MaxId { // constructors and destructors private MaxId() { <-- 1 ... } ... // public routines public static MaxId GetInstance() { <-- 2 return m_instance; } ... // private members private static final MaxId m_instance = new MaxId(); <-- 3 ... } (1)Here is the private constructor. (2)Here is the public routine that provides access to the single instance. (3)Here is the single instance.
Steve McConnell
Example 6-11. Java Example of Enforcing a Singleton with a Private Constructor public class MaxId { // constructors and destructors private MaxId() { <-- 1 ... } ... // public routines public static MaxId GetInstance() { <-- 2 return m_instance; } ... // private members private static final MaxId m_instance = new MaxId(); <-- 3 ... } (1)Here is the private constructor. (2)Here is the public routine that provides access to the single instance. (3)Here is the single instance.
Related Quotes
Let my silence grow with noise as pregnant mothers grow with life. Let my silence permeate these walls as sunlight permeates a home. Let the silence rise from unwatered graves and craters left by bomb...
Kamand Kojouri
Tags:
abuse, abused, activism, activism poems, activist, amnesty, bellies, bombs, broken hearts, coming together
About Steve McConnell
Steven C. McConnell is an author of software engineering textbooks such as Code Complete, Rapid Development, and Software Estimation. He is cited as an expert in software engineering and project management.