Can anyone tell, how can i write that program in C++, its little bit Object oriented programming related... but i really need to develop logic in C++
Here is the statement:
Write three classes names: circle, square and triangle, derived from class shape. Write down a function named intersect in an appropriate class which will take two of the shapes as parameters and tell whether they overlap or not.
here is the way, i have started:
Code:
1. class shape{
2. protected:
3.
4. public:
5.
6. };
7.
8. class triangle : public shape {
9. private:
10.
11. public:
12.
13. };
14.
15. class square: public shape {
16. private:
17.
18. public:
19.
20. };
21.
22. class circle: public shape {
23. private:
24.
25. public:
26.
27. };
28.
29. int main() {
Now i really need to know how can i develop the logic that take two of the shapes as parameters and tell whether they overlap or not.
Thanks in Advance..
Regards
Umar