Q) Draw an inheritance hierarchy for class Quadrilateral, Trapezoid, Parallelogram, Rectangle and square.Use Quadrilateral as the base of the hierarchy. Make the hierarchy as deep as possible.

Can anyone help me to create it as a proper program?

1) People here are not free homework generators; at best, you'll get help if you show evidence you've tried and encountered a particular problem.

2) This homework exercise does not require writing a program.

1) People here are not free homework generators; at best, you'll get help if you show evidence you've tried and encountered a particular problem.

2) This homework exercise does not require writing a program.

I know, that is why i am confused how to create it. As out teacher ask us to create it as a program.

Then ask your teacher for clarification of what he/she means. As worded, the question does not involve writing a program.

Q) Draw an inheritance hierarchy...

Take a pencil and a piece of paper and DRAW, DRAW, DRAW!

By the way, this is an initial phase in any serious programming endeavor : put something on paper first.
Don't start to run before you can walk.

commented: Absolutely! +23

Q) Draw an inheritance hierarchy for class Quadrilateral, Trapezoid, Parallelogram, Rectangle and square.Use Quadrilateral as the base of the hierarchy. Make the hierarchy as deep as possible.

Can anyone help me to create it as a proper program?

Well you have the base class already: Quafrilateral. That goes on top. Next in hierarchy would be the ones that are the closest to a quadrilaterl, that is, they share the same properties. Making it as 'deep' as possible means that you would probably want to create a pretty straight line vertically, rather than horizontaly: Like

class X
             |
          class Y
             | 
          class Z

Rather than 

          class X
           /     \
   class Y   class Z

It doesn't sound like you are being asked to write a program, just a diagram.

Thanx...
Sean

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.