Sample Problem (find syntax errors)
In Test.cpp
Test:Test()
{
var = 0.0;
}
float Test:Test(float i)
{
var = i;
}
float Test:method1( float x, float y )
{
return x*y*var;
}
float Test:method2( float y )
{
return (y+var)*y;
}
Test:~Test()
{
}
Test:~Test( int x )
{
}
In Test.h
class Test
{
public
float Test();
float Test( float i );
method1( float x );
method2( float y);
~Test();
~Test( int x )
private
float var;
}
Need semicolon after class definition
methods 1 and 2 need to return floats
constructor can’t return a value,
public and private need colons
Methods need double colons not single colons
Can’t overload the destructor
Have to #include “Test.h” in test.cpp