0

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.


Thanks in Advance..
Regards

Umar

3
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by umar7001
0

>> Can anyone tell, how can i write that program in C++
Write some C++ code that does the job.

A small starter point:

class shape{
protected:

public:

};

class triangle : public shape {
private:

public:

};

class square: public shape {
private:

public:

};

class circle: public shape {
private:

public:

};

int main() {
  return 0;
}

Work from there.

0

twomers, really thanks for the quick help. i can also define class names, but 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.
need some further help to move on.

Thanks in advance

Regards,
Umar

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.