the data members either with arguments or with some default values.
C# example
public Employee(string strName, int iAge) { m_strName = strName; m_iAge = iAge; }
Note: Use factory pattern for sophisticated construction of objects.
Rule: Have only initialization code in the constructor.
No comments:
Post a Comment