Class:
class Snumbers{ double metod(double m[]) { /* ---code--- */ return m[0]; // для примера } }; The main program:
int main(){ Snumbers A; int num; cin >> num; double *m1 = new double[num]; for(int i = 0; i < num; i++){ cin >> m1[i]; } cout << A.metod(m1); } The question is how can I pass an array to that class method, so that later I would work with it there, and that method would return what I write?
Update
Forgot to add public in class before method. That's how it should be
class Snumbers{ public: double metod(double m[]) { /* ---code--- */ return m[0]; // для примера } }; I get the error:
[bcc32 Error] F1.cpp (27): E2247 'Snumbers :: metod (double *)' is not accessible
public. - VladD