The virtual function and pure virtual function both are the concepts of run time polymorphism. The main difference between ‘virtual function’ and ‘pure virtual function’ is that ‘virtual function’ has its definition in the base class and also the inheriting derived classes redefine it. The pure virtual function has no definition in the base class, and all the inheriting derived classes has to redefine it. However, the virtual function is also called as dynamic dispatch and run-time dispatch, … [Read more...]
Difference Between Call By Value and Call by Reference
Call by value and call by reference are two different techniques to call a function or a method in a program. The call-by-value technique only passes the values of the variables. On the other hand, call by reference technique passes addresses of the variables. If you are passing arguments to a function using the 'call by value' technique, then changes to the variables inside the function won't affect the original values of those variables. If you pass arguments to a function using the … [Read more...]
Difference Between One-Dimensional (1D) and Two-Dimensional (2D) Array
An array is a collection of variables that are of similar data types and are alluded by a common name. The main topic of our discussion is the difference between One-dimension and Two-Dimension array. A one-dimensional array is a list of variables with the same data type, whereas the two-Dimensional array is ‘array of arrays’ having similar data types. A specific element in an array is accessed by a particular index of that array. Arrays in Java work differently as compared to C++. C++ do not … [Read more...]
Difference Between break and continue
Both “break” and “continue” are the ‘jump’ statements, that transfer control of the program to another part of the program. The main difference between break and continue is that break is used for immediate termination of loop. On the other hand, 'continue' terminate the current iteration and resumes the control to the next iteration of the loop. The break statement is primarily used as the exit statement, which helps in escaping from the current block or loop. Conversely, the continue … [Read more...]
Difference Between Type Casting and Type Conversion
The basic difference between type conversion and type casting, i.e. type conversion is made “automatically” by compiler whereas, type casting is to be “explicitly done” by the programmer. The two terms “type casting” and “type conversion” occur when there is a need to convert one data type to another. When the two types are compatible with each other, then the conversion of one type to other is done automatically by the compiler. Let’s discuss the difference both type casting and conversion … [Read more...]
Difference Between Static and Dynamic Binding
Binding association of a 'function definition' to a 'function call' or an association of a 'value' to a 'variable', is called 'binding'. During compilation, every 'function definition' is given a memory address; as soon as function calling is done, control of program execution moves to that memory address and get the function code stored at that location executed, this is Binding of 'function call' to 'function definition'. Binding can be classified as 'static binding' and 'dynamic … [Read more...]
Difference Between Local and Global Variable
As we discussed earlier, a variable is a name, given to a memory location, and it must be declared before it is used. In C, all the variables are declared at the starting of the program. In C++, variables can be declared, at any point of time, before they are used in the instructions. Variables are classified into ‘local’ and ‘global’ variable, which is the main topic of our discussion. Here the main difference between local and global variable is that a local variable is declared inside a … [Read more...]
Difference Between Identifier and Variable
The word ‘identifier’ clearly defines itself; an identifier is a name given to an entity, which distinctly identifies an entity in a program at the time of its execution. Variable is also an identifier; its name uniquely identifies itself in a program. Here, the fundamental difference between an identifier and variable is that an identifier is a “name given to entity” in a program whereas, a variable is a “name given to memory location”, that is used to hold value, which may get modified … [Read more...]
Difference Between Keyword and Identifier
Every language has keywords and identifiers, which are only understood by its compiler. Keywords are predefined reserved words, which possess special meaning. Each keyword defines the “type” declared data. Keywords should not be used as identifiers. An identifier is a unique name given to a particular variable, function or label of class in the program. To create a variable, both a keyword and an identifier are bind together. The identifiers can be altered if required, while this is not the … [Read more...]
Difference Between Function Overloading and Overriding in C++
Overloading and Overriding are the concepts of Polymorphism. In 'overloading' we redefine a function of a class with the same name but with, different numbers and types of parameters. In the 'overriding' prototype the overridden function is the same throughout the program but, the function to be overridden is preceded by the keyword 'virtual' in the base class and is redefined by the derived class without any keyword. Polymorphism is one of the crucial features of OOP. It simply means … [Read more...]