Advertisement
Guest User

Untitled

a guest
May 20th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. // ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there.
  2. //
  3.  
  4. #include "pch.h"
  5. #include <iostream>
  6. using namespace std;
  7.  
  8. class Point {
  9. int x;
  10. int y;
  11. public:
  12. Point();
  13. Point(int, int);
  14. int getCoordinates(int, int);
  15. void print();
  16. };
  17.  
  18. class Rectangle : public Point {
  19. Point *p1;
  20. Point *p2;
  21. Point *p3;
  22. Point *p4;
  23. public:
  24. Rectangle();
  25. Rectangle(int, int, int, int);
  26. void printALL();
  27. };
  28.  
  29. class RectangularPrism : public Rectangle {
  30. int height;
  31. public:
  32. RectangularPrism();
  33. RectangularPrism(int, int, int, int, int);
  34. void print();
  35. };
  36. int main()
  37. {
  38. Rectangle coordinates;
  39. coordinates.Point::Point(1, 1);
  40. coordinates.Rectangle::Rectangle(1, 1, 1, 1);
  41. coordinates.printALL();
  42. }
  43.  
  44. Point::Point()
  45. {
  46. x = 0;
  47. y = 0;
  48. }
  49.  
  50. Point::Point(int tempx, int tempy)
  51. {
  52. x = tempx;
  53. y = tempy;
  54. }
  55.  
  56. int Point::getCoordinates(int tempx, int tempy)
  57. {
  58. return x;
  59. return y;
  60. }
  61.  
  62. void Point::print()
  63. {
  64. cout << "(" << x << ", " << y << ")\n";
  65. }
  66.  
  67. Rectangle::Rectangle()
  68. {
  69. Point *p1 = new Point;
  70. Point *p2 = new Point;
  71. Point *p3 = new Point;
  72. Point *p4 = new Point;
  73. }
  74.  
  75. Rectangle::Rectangle(int tempx, int tempy, int tempx1, int tempy1) : Point(tempx, tempy)
  76. {
  77.  
  78. //Point *p2 = ;
  79. //Point *p3 = ;
  80. //Point *p4 = ;
  81. }
  82.  
  83. void Rectangle::printALL()
  84. {
  85. Point::print();
  86. cout << p1 << endl;
  87. cout << p2 << endl;
  88. cout << p3 << endl;
  89. cout << p4 << endl;
  90. }
  91.  
  92. RectangularPrism::RectangularPrism()
  93. {
  94. height = 0;
  95. }
  96.  
  97. RectangularPrism::RectangularPrism(int, int, int, int, int)
  98. {
  99.  
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement