Friend funtions are non member functions in C++ that have access to the private and protected members of a class.
Q2 . What are types of inheritance?
SOLUTION
Inheritance is accessing the elements of a parent class in its child class.some examples are
multiple inheritance
multilevel inheritance
Single Inheritance
hybrid Inheritance
Q3 . What is Encapsultion?
SOLUTION
It is the concept of bundling the data and the functions that manipulate it together.
Q4 . What is call by value?
SOLUTION
In call by value when a function is invoked only values are passed to the function.Any changes made in the function do not affect the original variables.
Q5 . What is call by reference?
SOLUTION
In call by reference the reference of the variables is passed to the function during invocation.So when the values are changed in the function the actual values get changed.
Q6 . What is enumeration?
SOLUTION
Enumeration is a user defined data type with defined values inside.
Example
enum days{
today=0,
tom=1,
};
Q7 . what is this pointer?
SOLUTION
This pointer holds the address of the current object.
Q8 . What is a try catch block?
SOLUTION
The try catch block is used for exception handling.
The try block is used to encompass the exception prone block
the catch block is used to catch the exception
throw is used to throw an exception
example
try{throw a=2;}
catch (int k)
{ }
Q9 . How to define a line break in C++?
SOLUTION
to define a line break in c++ we use a endl
for example cout< this will create a line break.
Q10 . How to do you comment out codes in C++?
SOLUTION
In C++ we want to comment out a single line it would be using //this will be commented.