Skip to content

Instantly share code, notes, and snippets.

@j03m
Created June 26, 2015 14:13
Show Gist options
  • Save j03m/f7e6416bef203d0ef425 to your computer and use it in GitHub Desktop.
Save j03m/f7e6416bef203d0ef425 to your computer and use it in GitHub Desktop.
i have so many reasons to hate c++
#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