fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Rectangle {
  5. int width, height;
  6. public:
  7. void set_values (int,int);
  8. int area() {return width*height;}
  9. };
  10.  
  11. void Rectangle::set_values (int x, int y) {
  12. width = x;
  13. height = y;
  14. }
  15.  
  16. Rectangle* getRect()
  17. {
  18. return nullptr;
  19. }
  20.  
  21. int main () {
  22. Rectangle* rect = getRect();
  23. rect->set_values (3,4);
  24. cout << "area: " << rect->area();
  25. return 0;
  26. }
Runtime error #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
Standard output is empty