facts about c

facts about c


Constructor

constructor is a special type of function or method in which there is No return type(Even void) and constructor name will be same as the name of the class.

There are two types of constructor
1.default constructor
2.parameterised constructor


Passing Objects as Function Arguments in C++
class Test
{
public :

/*here we are passing Test the name of the class as argument as we are going to pass objects as argument
this is the syntax of Passing Objects as Function Arguments*/

void display(Test)
};

//here we are passing t with Test as we are Passing Object (t) as Function Arguments.


void Test :: display(Test t) //
{
........
}

Friend function


A C++ friend functions are special functions which can access the private members of a class. 

friend function are defined with the keyword friend 

friend function return type Function name(class name);

friend function is not a member of class so we dont need to write class_name or use use scope resolution operator(::) like this class_name::function_name(). we simply write friend function as normal functions. 



download file now

Unknown

About Unknown

Author Description here.. Nulla sagittis convallis. Curabitur consequat. Quisque metus enim, venenatis fermentum, mollis in, porta et, nibh. Duis vulputate elit in elit. Mauris dictum libero id justo.

Subscribe to this Blog via Email :