#include<iostream>
#include<conio.h>
usingnamespace std;
class square;
class rectangle
{
int width,height;
public:
void setvalues(square);
int area()
{
return(width*height);
}
}
class square
{
int side;
public:
square(int);
friendclass rectangle;
};
void rectangle::setvalues(square x)
{
width=x.side;
height=x.side;
}
square::square(int y)
{
side=y;}
int main()
{
square mysq(4);
rectangle rect;
rect.setvalues(mysq);
cout<<rect.area();
getch();
}
i am getting an error as multiple types in one declaration in the 22nd line...
i am using wxdev c++on windows 7..
Any help or guesses is appreciated...
Don't worry about it, I doubt there's a programmer out there that hasn't forgotten to drop a semicolon at the end of their class or structure.
Did your compiler not error on line 14? It's strange because my compiler usually catches that and will error on it, but I have Visual Studios so that could be a factor, though it would still seem to be a relatively common error to catch.