Hi i am trying to think of how the algorithm of how this question works but no matter how hard i tried, i cant think of it. Can anyone give me a hand?? Any help or tip would be greatly appreciated.
Question:
Given 3 classes, equilateral triangle, isosceles triangle and rightangled
triangle, find the relationship in terms of inheritance among them and a
generic triangle class. Define each class’s data members and member
functions, making clear which are mutator, accessor, or virtual functions.
Write functions to calculate area and perimeter, sharing code as much as
possible.
Classes
Page 1 of 11 Replies  403 Views  Last Post: 08 December 2010  03:06 AM
Replies To: Classes
#2
Re: Classes
Posted 08 December 2010  03:06 AM
The base class for all these 3 triangle types is a triangle! and the common properties of it are the length of 3 sides of the triangle (and all 3 angles may be if you want)!!! Now you can head forward to identify what are methods required in all these classes.
I hope this will help you.
I hope this will help you.
Page 1 of 1
