+ 1
Can anyone help me understand how to make this work?
2 ответов
+ 2
What I read in your code.
All classes derive from the class person.
There are two properties there
Age and Speak.
So all derived classes (Teen, Child etc...) have the properties Age and Speak.
Age is set in the constructor of the derived class, this is good.
Speak feels like a method but is a defined as a property.
https://code.sololearn.com/cJ3FobvLlJ7k
I have made some changes to you code, to make it work.
Age is defined as
int
Age <= 4
is not a int, but a boolean statement or a string.
Keep Coding