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

>> 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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.