diff options
1 files changed, 8 insertions, 1 deletions
| -rw-r--r-- | Sem. 12/Example_polymorphism/Rectangle.cpp | 9 |
diff --git a/Sem. 12/Example_polymorphism/Rectangle.cpp b/Sem. 12/Example_polymorphism/Rectangle.cpp index 3fa1026..3797b41 100644 --- a/Sem. 12/Example_polymorphism/Rectangle.cpp +++ b/Sem. 12/Example_polymorphism/Rectangle.cpp @@ -23,4 +23,11 @@ double Rectangle::getPer() const Shape::point p3 = getPointAtIndex(3); return 2*(p0.getDist(p1) + p0.getDist(p3)); -}
\ No newline at end of file +} + +bool Rectangle::isPointIn(int x, int y) const +{ + Shape::point p(x, y); + return p.x >= getPointAtIndex(0).x && p.y >= getPointAtIndex(1).x && + p.y <= getPointAtIndex(0).y && p.y >= getPointAtIndex(2).y; +} |
