add polymorphism of cpp and java