+ 1
composition
I'm learning about composition and I noticed that if you do not use contructor initializer list to assign values to the object, it does not work... why is this? (without initializer list) https://code.sololearn.com/cYXmzgII3ext/?ref=app (with initializer list) https://code.sololearn.com/cI388PPbezFQ/?ref=app
1 Answer
+ 3
It is because in C++ if you only define a constructor with parameters you must always intilialize it with paremeters.
You have to overload the constructor to the eye class and add one that takes no parameters for it to work.