Sample Problem (give the output)
In driver.cpp
…
#include “Test.h”
int main()
{
Test a_test( 4.0 );
cout << “Result: “ << a_test.method1( 2.0 ) << endl;
…
In Test.cpp
#include “Test.h”
Test::Test(float i)
{
var = i;
}
float Test::method1( float x )
{
return x*var;
}
Test::~Test()
{
}
In Test.h
class Test
{
public:
Test( float i );
float method1( float x );
~Test();
private:
float var;
};