Computer scienceProgramming languagesKotlinObject-oriented programmingObject-oriented programming basic

Visibility modifiers for members

Protected Method

Report a typo

Inside the Friend class, declare a method called greeting() that should be available only in the Friend class and its subclasses. The function takes a parameter name as a string and returns "Hello $name".

Write a program in Kotlin
open class Friend {
// Write code here
}
___

Create a free account to access the full topic