Define the terms reference variable, member-dereferencing operator, function prototype, inline function.
Q. 1 What are reference variable in Object Oriented programming?
A reference variable provides an alternative name for a previously defined variable in a program code. For example, two variable like sum and total is used as the reference variable to each other in a single program.
Syntax reference variable in Object Oriented programming:
Data-type &reference-name = variable-name;
For example:
float total = 100;
float &sum = total; // here sum is referenced as reference variable for total
Q. 2 What is member-dereferencing operator in Object Oriented programming?
C++ permits to access the class members through pointers. It provides three pointer-to-member operators for this purpose:
1. (: :*) operator is used to declare a pointer to a member of a class.
2. ( * ) operator is used to access a member using object name and a pointer to the member.
3. (->*) operator is used to access a member using a pointer to the object and a pointer to that member.
Q. 3 What is function prototype in Object Oriented programming?
The function prototype describes function interface to the compiler by giving details such as number, type of arguments and type of return values
The function prototype is a declaration statement in the calling program and is of the following:
The syntax for function prototype:
Return_Type function_name(argument list);
Example of function prototype:
float volume(int x,float y);
Q. 4 what is an inline function in Object Oriented programming?
An inline function is a function that is expanded in line when it is invoked. That is compiler replaces the function call with the corresponding function code.
The inline functions are defined as:
Syntax:
Inline function-header
{
function body
}
Thanks
Mukesh Rajput
Post A Comment:
0 comments: