Object-oriented programming: C++ vs Java

Issue

C++

Java

universal superclass
None available. Templates are available to support generic programming.
Object
security levels
public, private, protected. These may label sections of code.
They may also specify types of inheritance
public, private, protected, private protected, default These modify variables, methods, and classes.
specifying the class(es) from which a class is derived
After the derived class name, put a colon, the type of inheritance, and the base class name(s); e.g.
class Derived : public Base {...};
After the derived class name, use extends followed by the base class name
.
calling the base class constructor in the derived class constructor
After the name and parameter list of the base class, put a colon, the call to the derived class constructor, and any initializers of the derived class; e.g.
Derived(int x, int y) : Base(x), myfield(y) {...}
Use super
run-time type determination
Calling typeid with the type name will return a reference to a type_info. The dynamic_cast operator can be used to determine whether the run-time type is as expected.
Use the instanceof operator to determine whether the run-time type is as expected.
abstract methods
suffix the prototype with = 0
label as abstract
abstract classes
no special syntax required; any class with an abstract method is abstract
label as abstract
redefinition of base class methods in derived classes
always permitted
permitted unless base class method is final
dynamic binding of methods to messages (true polymorphism)
permitted if base class method is virtual
always permitted (although inapplicable to final methods)