Item-38 Model 'has-a' or 'is-implemented-in-terms-of' through composition
· β 2 min read
In the application domain, composition means has-a. In the implementation domain, it means is-implemented-in-terms-of.
In the application domain, composition means has-a. In the implementation domain, it means is-implemented-in-terms-of.
Defaul parameter values are statically bound, while virtual function - the only functions we should be overriding - are dynamically bound.
Alternatives to virtual functions include the NVI idiom (as an example of the Template Method design pattern) and various forms of the Strategy design pattern.