Question #274042

Add two distances in inch-feet by creating a class named 'AddDistance'


Expert's answer

class AddDistance {
public:
  AddDistance(double a, double b): _a(a), _b(b) {}
  
  double apply() const { return _a + _b; }
  
private:
  double _a;
  double _b;
};
LATEST TUTORIALS
APPROVED BY CLIENTS