Hey i was trying to use Separating interface from implementation but got error. Not understanding what's wrong. Here's my program here's the error image
#include<iostream>
#include"name.h"
using namespace std;
int main()
{
int x,y;
cin>>x>>y;
name n1(x,y);
n1.getdata(x,y);
n1.showdata();
}
now here's the created header file
#include<iostream>
using namespace std;
class name{
private:
int a,b;
public:
name(int x, int y);
void getdata(int x, int y);
int showdata();
};
& here's the next part of class
#include"name.h"
using namespace std;
name::name(int x, int y)
{
a=0;
b=0;
}
void name::getdata(int x,int y)
{
a=x;
b=y;
}
void name::showdata()
{
cout<<a+b;
}