The const after the method header declares the method as read only - which you need for the line d = op.getA1(); since op is a const parameter.
Note that you can have both double Class1::getA1()
and double Class1::getA1() const
in the same class - the compiler will use the const one where the object is const, and the non-const otherwise.