Question: Create an instance of the class, Rectangle and reference it with the name MyRectangle. Class Square Declare Protected Side, Area As Float Public Square() Set
Create an instance of the class, Rectangle and reference it with the name MyRectangle.

Class Square Declare Protected Side, Area As Float Public Square() Set Side 1.0 %3! Set Area = 1.0 End Constructor Public Subprogram SetSide (NewSide) Set Side = NewSide End Subprogram Public Subprogram ComputeArea () Set Area = Side^2 %3! End Subprogram Public Function GetArea() As Float Set GetArea = Area End Function Public Function GetSide () As Float Set GetSide = Side End Function End Class Class Rectangle Extends Square Declare Private Height As Float Public Rectangle() Call Square () Set Height = 1.0 %3! End Constructor Public Subprogram SetHeight (NewHeight) Set Height = NewHeight End Subprogram Public Function GetHeight() As Float Set GetHeight = Height End Function Public Subprogram ComputeArea () Set Area = Side * Height End Subprogram End Class
Step by Step Solution
3.25 Rating (157 Votes )
There are 3 Steps involved in it
Declare ... View full answer
Get step-by-step solutions from verified subject matter experts
