There is nothing "semi" about C++, it is as object oriented as any language. However it doesn't force OOP on the developer and allows procedural programming as well. Whether or not you use objects is optional.
There are any number of differences between C++ and Java. To name two, C++ runs natively, Java in a java virtual machine; C++ has multiple inheritance and Java single inheritance.
C++ is semi object oriented programming language why?What are the major difference between java c++?
C++ can be described as a lower level programming language (generic C) with object oriented extensions tacked on top of it. This allows it to be as low level as generic C, and still permit those that wish to write more abstract code to use it for hard core object oriented programming.
Java is a higher level programming language. Imagine it as C++ without any of the generic C capabilities of manipulating low level machine constructs.
This is, of course, a gross oversimplification of the two languages, but gives you some idea from the 50,000 foot level.
At a little lower level, one of the major differences is that Java is an interpreted language. That is, when you compile Java code, you don't actually create anything that can be run natively on any machine. What is created is something called 'bytecode'. This intermediary product requires an 'interpreter' in order to run it on the specific hardware you are using. This interpreter is known as a 'virtual machine'. This allows the creation of 'virtual machines' for any type of computer platform you desire (Unix, Windows, Mac, etc). And that bytecode you generated on your Windows box will run without any modifications on a Unix or Mac system. %26lt;here's where all of the C programmers are quick to remind you that this isn't 100% true... because there are certainly things you can write in Java that will not work entirely the same on other systems - but this is definitely the exception and not the rule%26gt;
By contrast, when C or C++ gets compiled, it is ready to run. However, it will only run on the platform it was compiled on. If you want it to run on another platform, you have to compile your code on a machine with that platform.
So this is probably about the 40,000 foot level. To get any closer to the ground would start to take volumes of space, so as I was always told in my school texts, 'this will be left as an exercise for the reader'.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment