+ 1

Write a program

To show that the declaration of a class " rectangle" which derives from the class "Square" which in turns derive from the class " shape"

20th Jul 2018, 1:16 AM
Abrar Aslam
Abrar Aslam - avatar
3 Respostas
+ 4
class Shape {}; class Square: Shape {}; class Rectangle: Square {}; int main() { return 0; }
20th Jul 2018, 1:48 AM
John Wells
John Wells - avatar
+ 3
Because the syntax of defining a class requires them. Within them, you would declare whatever properties and methods you would like the classes to contain.
20th Jul 2018, 2:16 AM
John Wells
John Wells - avatar
0
I understand your concept but can you explain why are you using curly braces.
20th Jul 2018, 2:12 AM
Abrar Aslam
Abrar Aslam - avatar