Bloomberg LP Interview Question
Financial Software DevelopersOther differences:
c++: by default pass by value
Java: By defalut pass by reference except for primitive data types
c++: multiple inheritance
Java:no multiple inheritance but can implement multiple interfaces
C++: static building (must use virtual explicitly to make it dynamic)
Java: by default dynamic building.
java argument passing is always call by value.
can you write "swap" function in java?
c++ can pass the argument by reference. like this
void swap(T& a, T& b) { T t = a; a = b; b = t; }
Java does not support pre-processors. Thus no concept of macros as in C++.
Java supports classes but no structures or unions.
Java supports interfaces unlike C++.
No multiple inheritance in Java.
No copy constructor in Java, since all objects are passed by value.
No destructor in Java.
No virtual functions in Java.
* compilation unit
- Zaphod February 18, 2010+ java : 'public class SomeSource' should be in 'SomeSource.java'
+ c++ : no restriction.
* programming paradigm
+ c++ provides more programming paradigm such as functional language which support template meta programming feature, fucnctor so on. but java focuses more on OOP(i think)
* syntax comparison
c++ is more dynamic than java.(dynamic is not always good) more dynamic, harder compile and harder static analysis.
+ operator overloading
- c++ supports, java does not support
i cannot organize those difference :P