>>Could someone help me to understand more on class objects and help me on this code
Sure, what exactly do you want help on? The functions fadd(), fsub(), fmul() and fdiv() all take parameters but you failed to include them in the class declaration.
In the class function implementation code you did not specify the class, for example
float calculate::fadd(float a, float b, float c, float d)
{
return (a*d + b*c)/(b*d);
};
also what happends when (b*d) is zero? The function above will cause a divide by zero exception. Here is a better way of handling that
float calculate::fadd(float a, float b, float c, float d)
{
float denominator = b * d;
if( demoniator != 0)
return (a*d + b*c)/denominator;
else
return 0;
};
or like this using exception handling try/catch block
float calculate::fadd(float a, float b, float c, float d)
{
float value = 0;
try
{
value = (a*d + b*c) / (b * d);
}
catch(...)
{
// oops! divide by zero error
}
return value;
};