Link to home
Start Free TrialLog in
Avatar of Troudeloup
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;
}

ASKER CERTIFIED SOLUTION
Avatar of UrosVidojevic
UrosVidojevic
Flag of Serbia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Infinity08
Infinity08
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
imo, at least UrosVidojevic deserves part of the points since he clearly answered your question first ... I merely clarified a few points ...