Hello I'm a freshman in college. And just did a research about object oriented programming and the language that i'm studying is Kotlin, But i couldn't find a real reason why we need to use abstract class or methods at all.
For example :
abstract class Student(name: String, age: Int) {
init {
println("Student name is: $name")
println("Student age is: $age")
}
//non-abstract function
fun demo() {
println("Non-abstract function of abstract class")
}
//abstract function
abstract fun func(message: String)
}
class College(name: String, age: Int): Student(name, age) {
override fun func(message: String) {
println(message)
}
}
fun main(args: Array<String>) {
val obj = College("Chaitanya", 31)
obj.func("I'm a Blogger")
obj.demo()
}
reference : https://beginnersbook.com/2019/03/kotlin-abstract-class/
How is this showing only the essential data?