Please Help: Having issues with calling a function from class in main

All- Below is my code, I get an error:
"expected primary-expression before '.' token " on line 23, I have bolded the line below

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include<iostream>
using namespace std;

class addition {
    public:
           double add1(double x){
                  return x + 1;
                  
                  };                
      
      };

double add1(double x);

int main()
{
double x1;
double dsum;
    
    cout << "please enter your number " << endl;
    cin >> x1;

      dsum = addition.add1(x1);    
    cout << "sum is: " << dsum << endl;
        
    system("pause");
    return 0;
   
    
}
You can't call non static member functions from the class itself. You have to declare the function add1 as static.

Have a look at the class tutorial on this site for more information.
http://cplusplus.com/doc/tutorial/classes/
http://cplusplus.com/doc/tutorial/classes2/
Thanks for helping Xander314
Topic archived. No new replies allowed.