Achieving Forgetting Prevention and Knowledge Transfer in Continual Learning