Migrating from C+tto Java
Deconstruct versus Finalization When you move from C++ to Java, one of the more subtle, yet important issues you will face is the difference between a C++ constructor a Java finalize() method. Although similar in many respects, their actual operation is distinctively...
Migrating from C+tto Java
Converting C++ Multiple Inheritance Hierarchies In both cases, subclass C inherits classes A and U. However, in the hierarchy on the left, C Inherits both A and B at the same time. In the one on the right, Inherits A, B. By not allowing the inheritance of multiple...
Migrating from C+tto Java
Converting Default Arguments One extensively used feature of c++ that Java docs not support is default unction arguments. For example, tile areal ) function shown in the following c++ program computes the area of a rectangle if called with two arguments, 01′...
Migrating from C+tto Java
Converting C++ Abstract Classes into java Interface One of the most innovative aspects of Java is the interface. As explained earlier in this book, an interface specifies the form of its various methods without specifying any implementation details. Each class that...
Migrating from C+tto Java
c++ Reference Parameters Versus Java Reference Parameters In the preceding section, you saw an example of a C++ program that used a pointer parameter. In Java, this became a reference parameter. Of course, C++ also supports reference parameters. As mentioned, most...
Migrating from C+tto Java
Converting Pointers that Operate’ on Arrays Conceptually, converting C++-style pointer-based array accessing into the equivalent java-compatible array indexing is straightforward-simply substitute the appropriate array-indexing statements. However, in practice...