0
I know the basics of super, but for example : If I have a class mae Person with attributes name, age and sex, and a class daughter Student with attributes course, enrollment and period, and a class daughter of Student who is called Scholarship, how do I have to put in super all attributes of Student and Person, super type (name, age, sex, course, enrollment, period)? Because I did it in a code but error. Can’t post because if I put all classes here will be very big and hard to understand D:
I’ve added some related questions in addition to the duplicate that might help you better understand the
super
– user28595
Conceptual language reference: https://answall.com/q/252765/64969
– Jefferson Quesado
You wouldn’t put everything in the super. You’d put every attribute in the class it was declared in. So you would have the Stock Exchange Builder passing all attribute values
Bolsista(nome,idade,sexo,curso,matricula,periodo)
, as there is no attribute to set, just calls the super (Student) to set the restsuper(nome,idade,sexo,curso,matricula, periodo)
. Hence set the course, the enrollment and the period, and called the super (Person) to set the restsuper(nome, idade)
.– mari