Использование channing Method
#include
using namespace std;
/**
* @brief Method chaining
* @tparam T
*/
template
class Mathem {
public:
Mathem(T xx):m_value(xx){};
Mathem& add(T value){m_value+=value; return *this; }
Mathem& sub(T value){m_value-=value; return *this; }
Mathem& multiply(T value){m_value*=value; return *this; }
int getValue(){return m_value;}
operator T(){return m_value;}
private:
int m_value;
};
int main(){
Mathem operation(2);
operation.add(2).sub(3).multiply(5);
cout<
}