Advertisement
prprice16

Untitled

Oct 26th, 2021
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #pragma once
  2.  
  3. //always start with a capital letter!
  4. //class is a "cookie cutter"
  5. //default access of a class is private
  6. class Rectangle {
  7. private:
  8. //attributes are variables
  9. double length, width;
  10. //add a counter
  11. static int count;
  12.  
  13. public:
  14. //default constructor
  15. Rectangle();
  16. //parameterized constructor
  17. Rectangle(double, double);
  18. //a "square" constructor
  19. Rectangle(double);
  20. ~Rectangle(); //destructor
  21.  
  22. bool setLength(double);
  23. //inline function
  24. double getLength() { return length; } //no semicolon
  25.  
  26. void setWidth(double);
  27. double getWidth() { return width; }
  28. double getArea() const;
  29. double getPerim();
  30. int getCount();
  31.  
  32. };//semicolon
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement