Introduction
In the first article of this series, we compared how Java and C++ support
various object-oriented concepts. In this second and final part, we cover
other programming language concepts and examine differences in how the two
languages support them. Each programming language concept has its own
section, first presenting the concept in commonly-used terms and then
comparing how ANSI C++ and Java 1.0 implement, or can be used to implement,
it.
Object and Class Initialization and Finalization
Objects and classes both need to be given the opportunity to initialize their
contents before they are used, and to clean up before they are destroyed. For
objects, this is typically done using constructors and destructors.
Because Java has garbage collection, destructors are not needed. However,
there is still the need to allow an object to be cleaned up before being
de... (more)
Introduction
Much of the excitement about Java comes from C++ programmers looking for a
better way to develop software. In this article we take an in-depth look at
Java from the perspective of a C++ expert who wishes to quickly come up to
speed and transfer hard-earned knowledge of C++ to the new language.
Our purpose is not to disparage any particular programming language. Contrary
to what some would have you believe, Java is not the answer to all the
world's problems, and every language has its place. However, Java provides an
elegant solution to many problems in computing, and ... (more)