c++ and java, oop related stuff