Advertisement
adambkehl

Assignment #3 (2/3) - Page 444 #1

Feb 22nd, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3. using namespace std;
  4.  
  5. class ShareVariables {
  6. public:
  7. ShareVariables();
  8. ~ShareVariables();
  9.  
  10. void overloadMe(const char *a) {
  11. cout << a << endl;
  12. count++;
  13. return;
  14. }
  15. void overloadMe(const char *a, int b) {
  16. if (b > 0) {
  17. cout << a << endl;
  18. cout << count;
  19. }
  20. count++;
  21. return;
  22. }
  23.  
  24. private:
  25. int count;
  26.  
  27. };
  28.  
  29. ShareVariables::ShareVariables() {
  30. count = 0;
  31. }
  32.  
  33. ShareVariables::~ShareVariables() {
  34. }
  35.  
  36. int main(int argc, char **argv) {
  37.  
  38. ShareVariables c;
  39.  
  40. int count;
  41. char passMe[] = "Hello!";
  42. c.overloadMe(passMe);
  43. c.overloadMe(passMe);
  44. c.overloadMe(passMe);
  45. c.overloadMe(passMe);
  46. c.overloadMe(passMe);
  47. c.overloadMe(passMe, 2);
  48.  
  49. cin.get(), cin.get();
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement