I am wrtting a program in c++ using my own header file.
//main.cpp
#include<iostream>
#include"operation.h"
using namespace std;
main()
{
int a;
cout <<"Enter the value a";
cin>>a;
//class name add
//obj is object of add
add obj;
obj.fun(a);
}
//operation.h
class add
{
void fun(int b)
{
int c,d=10;
c=d+b;
cout<<"d="<<d;
}
}
when i compile using g++ compiler in linux it is showing error: expected ";" before obj ->obj not decleared in this scope
I don't understand this error, can someone help me?
thank you