Sample Problem (find the logic error)
In Test.cpp
#include “Test.h”
Test::Test()
{
var = 0.0;
}
Test::Test(float i)
{
var = i;
}
float Test::method1( float x )
{
return x*var;
}
float Test::method2( float y )
{
return (y+var)*y;
}
Test::~Test()
{
}
In Test.h
class Test
{
public:
float method1( float x );
float method2( float y);
~Test();
private:
Test();
Test( float i );
float var;
}
All the constructors are private – object cannot be instantiated