Created
June 26, 2015 14:13
-
-
Save j03m/f7e6416bef203d0ef425 to your computer and use it in GitHub Desktop.
i have so many reasons to hate c++
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
#include <iostream> | |
using namespace std; | |
class Rectangle { | |
int width, height; | |
public: | |
Rectangle (int,int); | |
Rectangle(); | |
int area() {return width*height;} | |
}; | |
Rectangle::Rectangle (int x, int y) { | |
width = x; | |
height = y; | |
} | |
Rectangle::Rectangle(){ | |
width = 5; | |
height = 10; | |
} | |
int main () { | |
Rectangle rect; //this is okay | |
//Rectangle rect(); //this is not | |
cout << "area: " << rect.area() << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment