I tried to do it this way,
import ballerina/io;
public isolated class Person {
public final string name;
public function init(string name) {
self.name = name;
}
public function printGreeting() {
io:println("Hello, " + self.name);
}
}
# Description
public isolated class Student {
*Person;
function init(string name) {
self.name = name;
}
public function printGreeting() {
// Use Person class function implemnetation here
return;
}
}
public function main() {
Student s = new ("Pratheek");
s.printGreeting();
}
but it does not gives the desired result. I need to re use the exact code in the Person printGreeting() method in Student printGreeting() method without duplication.