#include #include using namespace std; class Polynom { private: vector coeff; public: Polynom(const vector& v) : coeff(v) {} double operator()(double x) { double s = 0, xpot = 1; for (vector::size_type i = 0; i < coeff.size(); i++) { s += coeff[i] * xpot; xpot *= x; } return s; } }; int main() { Polynom p{vector{1, 2, 3}}; cout << "p(x) = " << p(2) << endl; return 0; }