What are the different types of Branching Statements?

Types of Branching Statements:
1. Break statement: Break statement is used to break the loop depending upon some condition. It is also used in switch statement so that after executing one case next case does not execute.
2. Continue statement: Continue statement is used to temporarily break the loop and then continue it after that.
3. Goto statement: Goto statement is used by the programmer to shift the control to any part of program where the label is defined.

What are the Friend functions?

Friend functions are useful in accessing the data declared in private section of the class. The data declared in private section of class is accessible to only the member functions of class but not to the non-member functions of class. If any non member function tries to access that data compiler will give an inaccessible error. In order to use that private data, friend functions are used. Friend functions can access the private or protected data of Class. A friend keyword is used to make a function as a friend of class.

Syntax:
Function return_type function_name(class object);

What is Polymorphism?

Polymorphism is made of two Greek words Poly which means many and morphos which means many forms. So, Polymorphism means many forms. It is a technique in which an object, operator, function or variable is used for performing multiple operations. So, when an object, operator, function or variable is used in many forms it is known as Polymorphism. Polymorphism is implemented by Function overloading and Operator overloading in C++ as in the case of function overloading a single function name is used for calling different functions and in case of operator overloading, an operator is used for performing multiple related operations.

Types of Polymorphism:

  1. Compile time polymorphism
  2. Run time polymorphism

What are the different types of Polymorphism?

Types of Polymorphism:

  1. Compile time polymorphism: Compile time polymorphism is implemented by Function overloading and Operator Overloading in C++. In compile time polymorphism compiler uses static binding which decides function calls at the compile time rather than at run time. It is also known as early binding.  In this type of polymorphism, lesser memory space is used. Also the calling of different functions is much faster because the function which is to be called is decided at the compilation time.
  2. Run time polymorphism: Run time polymorphism is performed by Virtual Functions in C++. In Run time polymorphism, compiler uses Dynamic binding which decides function calls at the run time rather than at compile time. It is also known as Late Binding as which function to call is decided at the run time. This type of polymorphism provides flexibility in calling functions.

What is Dynamic Binding?

Choosing Functions to call at execution time (run time) or in other words, attaching function call to its definition at run time is known as Dynamic or Late Binding. Dynamic Binding is implemented through Virtual Functions. In dynamic binding, calls to different functions are slower than Static Binding as compiler makes decision of function call at the run time.

What is Abstraction?

Abstraction is the process of displaying essential features of a program but hiding its internal details like the implementation of a program from the end user. For eg, when we login into any website we just enter the id and password but we don’t know the background details like how server checks the valid id or password etc. Low level of abstraction gives details about the implementation of the program whereas Strong level of abstraction hides it. High level languages provide Strong level of abstraction whereas Low level languages provide low level of abstraction.

What is Encapsulation?

Encapsulation means combining data and functions into a single unit. In Object oriented programming, encapsulation is implemented by Class. Encapsulation is used to implement Data hiding (Infromation Hiding). Class consists of both the data and functions. For example: Student class combines data like(roll _no, name, class, address) and functions(input() and show()) into a single unit.

What is an Object?

Object is an instance of the class to which memory space is allocated. In C++, problem to be solved is divided into objects which help in solving it in a better way than C language. Data and functions of a class are accessed using objects. We can create any number of objects of a class. Eg: Car, Scooter, Bicycle etc are objects of class Vehicle.

What are the Advantages of C++ Programming Language?

Advantages of C++ Programming Language:

  1. Provides reusability of source code by using inheritance.
  2. It helps in solving problems of real world by dividing a problem into real world objects.
  3. Provides security to data by using access modifiers like private, protected etc.
  4. Provides abstraction by displaying only essential features while hiding internal details.

What are the Drawbacks of C++ Programming Language?

Drawbacks of C++ Programming Language:

  1. It is not a platform independent language.
  2. C++ is not a pure object oriented language.
  3. Does not provide support for multitasking that is performing multiple tasks at the same time.