Illustrate Construction vs. SetData()
Learn about initializing objects using two different ways.
We'll cover the following...
We'll cover the following...
Problem
Between the constructor and setData( ) function, which should be preferred to initialize an object?
Coding solution
Here is a solution to the problem above.
DRY Principle: The initialization at multiple places should be avoided. The
constructorcan call thesetData()function for initialization.