Ok, I just switched from C to C++, so please bear with me...
I am writing a simple code to make sure I understand classes, and am getting the error message:
Code:
error: expected unqualified-id before âintâ
what am I doing wrong? Here's the full code:
Code:
#include <iostream>
using namespace std;
class firstclass
{
public:
firstclass();
int sum( int x, int y );
~firstclass();
};
firstclass::firstclass()
{
int z = 0;
}
firstclass::int sum( int x, int y)
{
z = x + y;
return z;
}
firstclass::~firstclass()
{
}
int main()
{
firstclass math;
int a = 0;
int b = 0;
cout<<"Enter two numbers: First: ";
cin>> a ;
cout<<"\nSecond";
cin>> b ;
cout<<"The sum is"<<math.sum( a, b )<<"";
}