List of Popular Difference between in C++

Difference Between C++ and Java

1.C++ support Pointer, Goto statement, Structure & Unions, Multiple Inheritance, Operator Overloading, Header Files, Global Variables, Template class concept.Java does not support Pointer, Goto statement, Structure & Unions, Multiple Inheritance, Operator Overloading, Header Files, Global Variables, Template class concept.
2.C++ does not support Interface, Packages, Virtual keyword and API concept. Java supports Interface, Packages, Virtual keyword and API concept.
3.C++ supports Procedural as well as OOPs concept. Java supports OOPs concept only.
4.C++ is Platform dependent.Java is Platform Independent.
5.C++ is only Compiled.Java is Compiled as well as Interpreted.
6.C++ supports both Pass by Value and pass by reference.Java supports only the Pass by Value technique.
7.C++ mostly used in System Programming.Java is mostly used in Application programming.
8.C++ doesn't have built-in support for threads rather it relies on third-party libraries for thread support.Java uses thread concept and have built-in thread support.
9.C++ is very nearer to hardware in interactive sense.Java is not so nearer and interactive with hardware like C++.

Difference Between C and C++

Slno C C++
1. The variable declaration in C, must occur at the top of the function block region and it must be declared before any executable code. C++ variables can be declared anywhere in the program.
2. There is no such scope resolution operator(::) facility in C language. In C++, we can change the scope of a variable by using scope resolution operator(::).
3. C Language follows the top-down design approach. C++ follows both top-down and bottom-up design approach.
4. C is a procedural language. C++ is an object-oriented language.
5. C allows a maximum of 32 characters in an identifier name
C++ allows no limit on identifier length.
6. C language does not allow this feature. C++ is an extension to C language and allows declaration of class,
7. C language does not support oops feature. It allows oops feature.


Difference between Structure and Class

Slno Structure Class
1.  ‘Struct’ keyword is used to create fresh/new structure. ‘class’ keyword is used to create a fresh/new class.
2.  ‘Structure variable’ is  present to handle structure elements of the structure. ‘Object’ is present to handle data members and member functions of the class.
3. Members of structure (called structure elements) are public by default.  Members of a class are private by default. 
4. Structure elements are only of public type. Class members may be public, protected and private or mix of all these, depends on requirements.
5. No security of structure elements at all, present in a structure.  Class members may be no secure(public), medium secure(protected) and highly secure(private) or all these, depends on requirements/situation.
 6. Structures are best suited for handling small data structure as well. Structures are good for small and isolated model objects Classes are used to model more complex behavior/data.  classes are suitable for larger or complex objects.
 7. A structure can’t be of abstract type. A class may be of abstract type.
 8. A structure contains only data member/structure elements.  A class contains both member data and member functions. 
  9.  In a structure, we can’t initialize the value to the structure elements directly.  In a class, we can assign the values to the member variables directly. 
 10. Structure does not show inheritance and hence can’t be inherited. Classes show inheritance property and can be inherited, as well.
 11. Structure show only the parametrized constructor specially . A class shows all types of constructor i.e. default constructor ,copy constructor , and parametrized constructor.
  12.  A structure doesn’t support destructor services/facility.  A class support destructor facility. 
 13. The structure can’t contain a volatile fields. The class contain volatile fields.
 14. Structure uses sizeof operator. A class doesn’t use sizeof operator.
  15.  Empty structure elements in a structure are not initialized automatically. Empty Fields/class members in a class are automatically initialized with 0/false/null values by default
 16. A struct is a value type i.e. when we create structure, the variables value are assigned & holds the struct’s actual data and when new struct is created and assigned a new variable then the new variable and the original variable contain two separate copies of the same data. Finally, changes made to one copy do not affect the other copy.Thus structure is pass-by-copy of value. Class is a reference type i.e. when an object of a class is created, the variable of  object of that class is assigned & holds only a reference to that memory. Changes made through one variable are reflected in the other variable because they both refer to the same data and class is pass by reference type.
17.  Structures are stored/created as a stack in memory i.e. When we create a new structure, it will be allocated as stack in memory.  

When we create a new class it will be allocated as heap in memory.

18.  Normally structure can be used for grouping of data. Class provides flexibility for linking data and also gives re-usability concept.
 19. In structure, there is no garbage collector mechanism hence there is no efficient memory management technique. Classes have an efficient garbage collector mechanism. 
 20. A structure without elements occupies zero byte space in memory. The class without members (empty) occupies one byte space in memory.

Difference Between Early binding and Late binding
SlNoEarly BindingLate Biniding
0.Early Binding is also known as static binding.Late Binding is also known as dynamic binding.
1.The process of using the class information to resolve method calling that occurs at compile time is called Early Binding. In other words, the method definition and method call are linked during the compile time.The process of using the object to resolve method calling that occurs at run time is called the Late Binding. In other words, the method definition and method call are linked during the run time.
2.Early Binding uses the class information to resolve method calling.Late Binding uses the object to resolve method calling.
3.Overloading methods are bonded using early binding.Overridden methods are bonded using late binding.
4.Execution speed is faster in early binding.Execution speed is lower in late binding.
5.Example - Function/Method OverloadingExample - Function/Method Overriding
Categories: C++


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.