Question: b) A graphical user interface is being developed that displays basics shapes on the screen. There are three classes that a programmer has been
b) A graphical user interface is being developed that displays basics shapes on the screen. There are three classes that a programmer has been tasked to design: shape, square, and circle. shape should be an abstract class and square and circle are concrete (i.e. not abstract) subclasses of shape. To hold the size information, each class has a protected field length of type float. The value of this field is only stored in the shape class and its value is initially set by the three constructors. Each class also has a getter and a setter method. All three classes have a function float calculateArea (). In the class shape this is defined as virtual float calculateArea () const = 0; The function returns length*length for square and 3.14*length for the circle class. i) Write the classes described above in C++. ii) In the calculateArea definition explain the meaning of the following parts: virtual, float, const and =0. [8 marks] [4 marks]
Step by Step Solution
3.36 Rating (149 Votes )
There are 3 Steps involved in it
This prompt appears to be a part of an assignment or an exam relating to objectoriented programming in C Below Ill address the two parts of the questi... View full answer
Get step-by-step solutions from verified subject matter experts
