0

C++ vs Java?

What are the pros and cons of the two languages?

14th May 2017, 10:29 PM
CommentSense
CommentSense - avatar
1 Odpowiedź
+ 2
SyntaxEdit See also: Java syntax and C++ syntax Java syntax has a context-free grammar that can be parsed by a simple LALR parser. Parsing C++ is more complicated. For example, Foo<1>(3); is a sequence of comparisons if Foo is a variable, but creates an object if Foo is the name of a class template.C++ allows namespace-level constants, variables, and functions. In Java, such entities must belong to some given type, and therefore must be defined inside a type definition, either a class or an interface.In C++, objects are values, while in Java they are not. C++ uses value semantics by default, while Java always uses reference semantics. To opt for reference semantics in C++, either a pointer or a reference can be used.
15th May 2017, 12:29 PM
Pallav Panwar
Pallav Panwar - avatar