MathWorks interview question

OOP design question, C++ vs Java objects, logical question