Your listing is in the private part of the class.
By default, a class runs by default in private , while struct starts by default in public .
Move it to the open part
Also, return the value by reference, in the constant getter method, or the performance and quality of the interface as a whole.
I would also type the matrix myself and immediately use it in the classroom, which made me put the private part in the end.
Edit: since the answers to the questions also mean educational materials from others, I completely reworked the example with links to const, auto, all types of private, all work, just for writing (and it builds).
#include <vector>
source share