In my opinion, the
Triangle class and any subclasses derived from it should present to the user an interface that enables the values of any of its angles to be queried individually, even if the angles are all equal, or if two of them are equal. There are a number of ways that this could be done, but it seems that the simplest scheme is for all
Triangles and child classes to have
angle3 instance variables. However, strictly speaking, the internal design of the classes is not what is paramount. The primary issue is that any instance of
Triangle or a derived class should present the appearance of having three individual angles, regardless of how the classes are implemented.
Let's consider a hypothetical guessing game in which a
list of triangles is randomly generated and the player has to guess each of the angles of each triangle. Some of the items in the
Triangles, while others are
Equilaterals, and others are instances of
Isosceles, which has not been defined in the Codecademy exercises. It would be most convenient for the programmer of the game to be able to query each angle individually, regardless of the class of the instance, so long as it is a
Triangle or a class derived from it. Perhaps the game enables the user to guess the first angle, in a loop, and when that one is guessed correctly, have another loop for guessing the second angle.
In summary, we should design groups of types so that when the objects they represent share a commonality, such as three angles in the case of a triangle, we are able to treat, programmatically, instances of the parent class and all derived class similarly with regard to those commonalities.