Cannot reduce the visibility of the inherited method from PortfolioManager

I am implementing calculateAnnualizedReturn method (which is only declared in portfolioManager interface )in the PortfolioManagerImpl but error shows
#Cannot reduce the visibility of the inherited method from PortfolioManager
I tried making this method public in interface but error persists .

In interfaces, all the methods are already public. use public also in a class where you are overriding functionality of the interface.

thats already public , I mean …
it should work ?
public void A implements B {
void implementing_func()
{}
}

This error specifies that the function which you are overriding in the implementation class is not made visible to other classes
To make it visible you need to add a keyword of public at the start of declaration and implementation of the function.
I hope it helps

1 Like

no, you have to make both public interfaces as well as overridden methods.
As @yakshit mentioned.

see this image it will give you more understanding where this problem occurs

2 Likes

Interface methods are public by default. You need to do the same for the classes in which you implement them. That’s solve the issue.