i have a very simple program and i'm running into a
"error C2228: left of '.calcArea' must have class/struct/union type" error.
i've tried messing with different naming conventions and such...but here's my code:
Code:
headerfile: 2dArea.h
class square
{
protected:
int length;
int height;
public:
SquareCon ();
void calcArea (int, int);
void setParams (int, int);
};
//class cube: public square
///{
// private:
// int depth;
// public:
// CubeConstructor ();
// CubeConstructor (int, int, int);
// int calcVolume (int, int, int);
//};
2dArea.cpp file:
#include <iostream.h>
#include "2dArea.h"
square::SquareCon ()
{
length = 0;
height = 0;
};
void square::setParams (int len1, int ht1)
{
length = len1;
height = ht1;
};
void square::calcArea (int len1, int ht1)
{
(len1*ht1);
};
main.cpp file:
#include <iostream.h>
#include "2dArea.h"
extern void main ()
{
square SquareCon();
int len1;
int ht1;
cout << "Please enter the length of your square: " << endl;
cin >> len1;
cout << "Please enter the height of your square: " << endl;
cin >> ht1;
cout << "The area of your square is: "<< SquareCon.calcArea << endl;
}
that last cout line is where i get the error.
any help would do wonders!
Thanks.