Fattyrivers

Untitled

May 8th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #include<iostream>
  2. #include<string>
  3. #include <cstdlib>
  4.  
  5. using namespace std;
  6.  
  7. class house
  8. {
  9. public:
  10. house() {
  11. floors = 3;
  12. rooms = 20;
  13. }
  14.  
  15. int getFloors() {
  16. return floors;
  17. }
  18. int getRooms() {
  19. return rooms;
  20. }
  21. private:
  22. int floors;
  23. int rooms;
  24. };
  25.  
  26.  
  27. class Houseadress : public house
  28. {
  29. public:
  30. Houseadress(string s, int p) {
  31. address = s;
  32. pincode = p;
  33. }
  34. string getAddress() {
  35. return address;
  36. }
  37. int getPin() {
  38. return pincode;
  39. }
  40. private:
  41. string address;
  42. int pincode;
  43.  
  44. };
  45.  
  46. {
  47.  
  48. Houseadress h1("fdljfhslfhlsflshf", 200);
  49.  
  50.  
  51. cout << "Rooms: " << h1.getRooms() << endl;
  52. cout << "Floors: " << h1.getRooms() << endl;
  53. cout << "address: " << h1.getAddress() << endl;
  54. cout << "zipcode: " << h1.getPin() << endl;
  55.  
  56. system("pause");
  57. return 0;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment