Вы находитесь на странице: 1из 1

Quizz PII :

Write a program that defines the following : y A class named Shape that has o an attribute color o two methods Area () and Perimeter () that return the value 2.5 y A class named Rectangle derived from Shape class and has two attributes : width and depth. y A class named Square derived from Shape class and has a attribute : side. The classes Rectangle and Square must override the methods Area() and Perimeter() to calculate the area and the perimetre for both classes. The attribute Color should not be accessible from out of these three classes. Justify your code by creating some objects of all the types and invoking the methods.

Вам также может понравиться