both :are compiler based language
use :class concept
java uses: jvm compiler
c++ use : turboc++ compiler
both are bject oriented language
in java everything :is object except datatype
than it mde them also wrapper class.
object oriented issues
1. inheritance : parent to child
2. polymorphism : dynamic binding
3. encapsulation : hiding
so my question is :
which language whether c++ or java is more object oriented
in which language we can wisely use reuasble object
here are my understandings please reply!!!
C++ is not purely an Object Oriented language(OOL)
if aloanguage has to be OOL then it should not support Global functions and Global Data but C++ supports such global things...
and in OOL every thing muct be Objects
java is 99.99% OOL(pure)
it is said so coz in java Primitive data types are not objects!!!
java codes are portable i mean platform independent
THE Other difference is in the case of NAMESPACES!!!.. i am still reading about it!!!
i am not sure !!! of my answers....
just my curiosity made me there!!!
just!!! reply guys!!!
As to the mode of execution (interpreter, compiler, VM, some mixed form), that's largely independent of the language. C/C++ tends to be compiled to native code, Java tends to be compiled to byte code, which is then either interpreted or compiled to native ocde or both at the same time. Other modes are possible for both languages, and they do exist, even if they are largely irrelevant outside of R&D.
i am not sure !!! of my answers....
In that case, maybe you should use fewer exclamation marks
Java is more OO as there are no loose functions or variables declared outside the context of a class definition. C++ can be used to write superior C code that can be compiled directly by an ANSII C compiler. C is entirely procedural.
Interesting side note is that creating object oriented (small 'o') programs in C was an extremely popular and sucessful design pattern. C languages allowed the definition of data records called structs -- short for structure. Skilled software engineers would always define data structures then build functions that operated specifically on those data structures. They would then be delivered as a unit. It was surprisingly simple for the skilled C programmer to move to C++. C++ was just formalizing what they had always done in a more convenient way.
c++ is much more closer to the implementation of object-oriented theory, as it allows multiple inheritance
OO is not a theory like relational databases are - it's more of a set of concepts. One of those is inheritance, which Java supports. Whether multiple inheritance is a "truer OO" is very much up for debate.
It's not a generally accepted requirement for object-oriented languages, but Java certainly has it. Java does not have the ability to write an application that uses no object oriented features whatsoever; C++ definitely does.
There are only two issues that I miss from C++ with respect to Java and neither is object-oriented:
1. A more general const modifier:
int safeMemberFunction( String bar ) const
2. Default arguments:
int foo( int x, int y = 0, int z = 0 ) ...
Item one allows for much safer more robust programs.
Item two eliminates this sort of thing:
int foo( int x )
int foo( int x, int y )
int foo( int x, int y, int z)
Variable argument lists are an OK work around.
Sounds like a contradiction to me. Syntactically, the languages have a lot in common. In practice, the most obvious differences are that C++ allows the developer to use pointers (and pointers to pointers, etc.) and Java does not. Advantage Java. Pointers have been a common source of hard-to-spot bugs.
Originally posted by Rick O'Shay:
Java and C++ have little in common so it's easier to describe where they are alike. Java syntax has a significant overlap with C++ programming syntax.
Also, C++ uses contructors like Java, but C++ also has the concept of DEstructors to delete objects. Java has a garbage collector instead, so the potenial for memory leaks is much less.