Made solve function virtual