# Classes

Page 1 of 1

## 1 Replies - 528 Views - Last Post: 08 December 2010 - 03:06 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=204307&amp;s=70e629eaa4e2c3c89fad0a73b13fcd48&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 Tiancailee

Reputation: 0
• Posts: 59
• Joined: 04-December 10

# Classes

Posted 08 December 2010 - 02:58 AM

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

Is This A Good Question/Topic? 0

## Replies To: Classes

### #2 AmitTheInfinity

• C Surfing ∞

Reputation: 119
• Posts: 1,565
• Joined: 25-January 07

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