Troudeloup
asked on
[noob][c++] class declaration.
this is from
http://www.cplusplus.com/doc/tutorial/classes.html
what is this?
CRectangle (int,int);
// example: class constructor
#include <iostream>
using namespace std;
class CRectangle
{
int width;
int height;
public:
CRectangle (int,int);
int area ()
{
return (width*height);
}
}
;
CRectangle::CRectangle (int a, int b)
{
width = a;
height = b;
}
int main ()
{
CRectangle rect (3,4);
CRectangle rectb (5,6);
cout << "rect area: " << rect.area() << endl;
cout << "rectb area: " << rectb.area() << endl;
return 0;
}
http://www.cplusplus.com/doc/tutorial/classes.html
what is this?
CRectangle (int,int);
// example: class constructor
#include <iostream>
using namespace std;
class CRectangle
{
int width;
int height;
public:
CRectangle (int,int);
int area ()
{
return (width*height);
}
}
;
CRectangle::CRectangle (int a, int b)
{
width = a;
height = b;
}
int main ()
{
CRectangle rect (3,4);
CRectangle rectb (5,6);
cout << "rect area: " << rect.area() << endl;
cout << "rectb area: " << rectb.area() << endl;
return 0;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
imo, at least UrosVidojevic deserves part of the points since he clearly answered your question first ... I merely clarified a few points ...