October 2018
Intermediate to advanced
370 pages
9h 15m
English
Inheritance is one of the key concepts in object-oriented programming. It involves avoiding code-repetition, especially where different classes have common features and all the classes belong to the same type. Let's say we are writing software for an educational institute in which three different entities are involved—Student, Professor, and Employee:

All these entities have some properties in common, including name, age, and id. Each entity exhibits some behaviors, such as speak or greet. Let's convert the diagram of the Professor class into code:
class Professor(val fName: String, var lName: String, var pAge: Int, val ...
Read now
Unlock full access