intro

This topic contains 0 replies, has 1 voice, and was last updated by  মু. আ. হাকিম নিউটন 2 years, 5 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #120

    // SOURCE: http://www.cplusplus.com/doc/tutorial/classes/
        // classes example
        #include <iostream>
        #define DOIT 1
        using namespace std;
        class CRectangle {
            int x, y;
          public:
            void set_values (int,int);
            int area () {return (x*y);}
        };
        void CRectangle::set_values (int a, int b) {
          x = a;
          y = b;
        }
        /*
        void CRectangle::set_valueA (int a) {
          x = a;
        }
        */
        int main () {
          CRectangle rect;
          rect.set_values (3,4);
          cout << "area: " << rect.area();
          
          CRectangle rect2 = new CRectangle();
          
          int x = 0x54b4c2;
          int y = 291;
          int z = 0b1110101;
          
          
          #ifdef DOIT
          cout << __FILE__ << __LINE__;
          #endif
          
          return 0;
        }


     

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.