web analytics

August 2013

What is parameterized constructor? Give an example.

Parameterized Constructor: We know that when we create an object the constructor function gets execution automatically. Consider the following lines of codes, constructor(){ //this is the constructor function a=1; //initializing }void main(){ constructor ob1,ob2; } When this executed the value of ‘a’ for both ob1 and ob2 sets to 1. But when we want different …

What is parameterized constructor? Give an example. Read More »

What is function overloading? Discuss this.

Function Overloading: Overloading refers to the use of the same thing for different purposes. When the same name for different functions is used that is called function overloading. The functions are then distinguished by their parameters or argument lists. Functions can be overloaded by changing, increasing or decreasing their arguments, float add(float a, float b)int …

What is function overloading? Discuss this. Read More »

Write some properties of constructor?

Properties of Constructor Function: Following are some properties of Constructor Function They will have the same name as of their class. They should be declared in the public section. They are executed automatically when objects are created. They do not have return types, not even void and thus they can’t return values. They can’t be …

Write some properties of constructor? Read More »

How does a static member variable or static data member differs from a non-static variable or data? Explain with an example.

Static Data Member and Difference with Non-static Data Member: In general when we declare some objects of a class, each object is allocated with memory space for each variable of the class separately under them as given below, But in the case of static data member only one memory location will be allocated and that …

How does a static member variable or static data member differs from a non-static variable or data? Explain with an example. Read More »

Write down some properties of static member function.

Properties of Static Member Function: Following are some properties of Static Member Function A static member function can only have access to other static data members and functions declared in the same class. A static member function can be called using the class name with a scope resolution operator instead of object name. Global functions and …

Write down some properties of static member function. Read More »

What is inline function? Give some uses of it.

Inline Function:Every time a function is called, it takes a lot of extra time in executing a series of instructions for tasks such as jumping to that function, saving registers, pushing arguments into the stack and returning to the calling function. Also when a function is small a large percentage of execution time may be …

What is inline function? Give some uses of it. Read More »

What is friend function? Explain the use with an example.

Friend Function: Friend functions are those functions which can access all the functions and  variables of a class though it is not a member function of that class. Actually to share a function among two or more classes friend functions are used. If it is declared so, then it will able to access all variables …

What is friend function? Explain the use with an example. Read More »

RSS
Follow by Email
Scroll to Top