Hey,
I have one class Company and one Item class which is an object in Company class as shown:
public abstract class Company {
@Inject
private ItemClass item;
void companyMethod() {
this.item.itemMethod();
}
}
public class ItemClass {
public void itemMethod() {
// logic
}
}
So, many class inherits the Company abstract class say ClassA, ClassB, ClassC. So,
public class ClassA extends CompanyClass {
void ClassAMethod() {
}
String getName() {
//logic
}
}
So, now when I declare a variable of ClassA say: classAObj . I called:
classAObj.companyMethod()
Now, I want to call ClassA's getName function in ItemMethod() of item class. Can i use this somehow? I need to call getName() there and take string value from this function? Using this or similar somehow?
Thanks in advance.