How to instantiate PortfolioManagerImpl class has only one constructor that too is protected and hence it is not possible to make an object of PortfolioManager interface required in the mainCalculateReturnsAfterRefactor function in Please help!

Another question which popped up my mind was what is the use of keeping the class PortfolioManagerImpl public if the only constructor it has is protected?

As you know we are using factory concept here…do note that function which is present in portfoliomanagerfactory ie given to you. Read the TODOs, its clearly mentioned what has to be done

refer these two links

Yes, It is not posssible to create an instance of PortfolioManagerImpl in PortfolioManagerApplication. However, you can create an instance from the factory class.