What are different OOP concepts that are in C++ but not in Java?
-
e.g. multiple Inheritance,operator overloading,virtual function/class ..etc
-
Answer:
I can't cite all but 2 prominent ones are: 1. all functions in Java are virtual, in C++ you have to explicitly declare virtual. Virtual functions are those that can be overridden in subclasses. 2. C++ allows multiple inheritance, Java doesn't.
Quora User at Quora Visit the source
Other answers
There are three main principles of OOP. These include encapsulation, polymorphism and inheritance. C++ and JAVA differ in approach to each of the above principles. Encapsulation - JAVA follows encapsulation strictly. Everything has to be written within the boundary of the class. However in C++, one can still define the main( ) method outside a class declaration, which is not possible in JAVA. Polymorphism - C++ supports four different types of polymorphism. They are method overloading, constructor overloading, operator overloading and method overriding. However, you cannot overload operators in JAVA. Inheritance - C++ supports multiple inheritances, which JAVA does not. Still, if the need arises, one can make use of interfaces in JAVA for the same purpose. Besides, JAVA has done away with the concept of friend functions.
Saheb Haque
1) C++ allows friend classes to access members of a class 2) Java all class methods are virtual. 3) Java does not allow multiple inheritance 4) Java is fully object oriented. (everything apart from basic datatypes are classes)
Ramprasad Gopalakrishnan
Related Q & A:
- What are different types of Entities in Entity Framework?Best solution by entityframeworktutorial.net
- What is Different Perspectives of Advertising Creativity?Best solution by Yahoo! Answers
- How is .txt file different from a .dat file in C?Best solution by mycplus.com
- What can i do to fix my P.C?
- What is the difference between Hepatitis A, B & c?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.