What is Pointer?
Pointer is very important in C and C++. It's a variable which stores memory of user type and primary variable. It Hold the value of memory of a variable.
Why we use Pointer?
Some time we need to storing the address of variable for solving this problem we use pointer which capable to storing the memory address of a variable.
Guideline for using pointer
1. Define * When we use pointer
2. when we store address of pointers of pointer then we use **variable name
Example of Pointer
#include<iostream.h>
int main ()
{
int first,second;
int * ptr;
ptr = &first;
*ptr...
Sunday, August 29, 2010
How to use Pointer in c tutorial | Pointers in Cplusplus | pointer in c language
Posted by
Unknown
,
at
1:50:00 AM

Read more →
String Operations in cplusplus
Posted by
Unknown
,
at
1:49:00 AM
String Handling:-A string is a collection of characters.String is a class in cplusplus and there are three constructors in the String class.
1.)String():-For creating an empty string
2.)String(Const char *str):-For creating a string object from a null terminated string
3.)String(const string &str):-For creating a string object from other string object
#include<iostream.h>
#include<string.h>
void main( )
{
char ch1[] = “Cplusplusexample”;
char ch22[80];
for(int i=0; i
ch2[i]=ch1[i];
ch2[i]=’\0’;
cout<< “The copied string is “<< ch2;
}
Output:-The copied...
Exception Handling in Cplusplus
Posted by
Unknown
,
at
1:49:00 AM
Exception handling:-Exception Handling is used in object oriented programming.It is feature by which we can handle easily a lot of feature.so that u can easily debug the code and to find the where the actual problem reside.In the Exception Handling we can use the try and the catch block
In the try block we can use the code in which the error may be occured that are to be placed in try block.
In the catch block particular error are to be handled in which way.The solution of particular error are provided in the catch block.
Example:-
#include<iostream.h>int main(){int a,b;cout<<”Enter...
Thursday, August 26, 2010
Example of constructor overloading c++ | How to Constructor Overload
Posted by
Unknown
,
at
2:18:00 PM
class CO
{
private:
int a;
int b;
int c;
public:
CO(int x,int y,int z);
CO(int x,int y);
CO();
void show()
{
cout<<"\na="<<"b="<<<"c="<
}
};...
Dynamic Binding
Posted by
Unknown
,
at
1:24:00 PM
Definition of Dynamic Binding:-Binding means that a procedure call of the code is executed , when we call the particular code.
Dynamic Binding means at the run time we know that which code is particularly associated to which code.
Dynamic Binding also known as Late Binding.
It is generally associated with polymorphism and Inheritan...
Message Passing
Posted by
Unknown
,
at
1:23:00 PM
A mesage for an object is a request for execution of a procedure,and therefore will invoke a function in the receiving object that generates the desired result
Example:-Employee.salary(nam...
Encapsulation
Posted by
Unknown
,
at
1:21:00 PM
What is Encapsulation?
The packing of data member and member functions into a single component is called Encapsulation.The data is not reached by the outside functions.Only those functions that are able to access the data are defined within a class.Class is the best example of Encapsulati...
Monday, August 16, 2010
Scope Resolution Operator
Posted by
Unknown
,
at
1:39:00 PM
Definition of Scope Resolution Operator:-The scope access(or resolution operator)operator :: (the two semicolons)allow programmers to access a global name even if it is hidden by a local re-declaration of that name. When we declare a variable it is available only to a specific part or block of the program.Remaining block cannot access the variable .The area of a block where the variable is accessed is known as the scope resolution operator.
Example:-#include int a=10; main() int a=20; cout<<"::a"<<::a; cout<<"a="< return 0;
Result:- 10 ...
Saturday, August 14, 2010
Constants
Posted by
Unknown
,
at
3:23:00 PM
Definition Of Constant:-The constants in C and C++ are applicable to the values ,which do not change during the execution of a program.There are a several type of constants in C and C++.They are Claasified into various categories are as follows:-1.)Integer Constant2.)Real Constant3.)Character Constant4.)String Constant1.)Integer constant:-Integer constants are those who provide the numbers are either positive or negative.Example:-const int a=5;2.)Real Constant:-The real constants can be written in exponential notation,which contains a fractional part and an exponential part.Example:-Const float=3.4;3.)Character...
Identifiers
Posted by
Unknown
,
at
3:22:00 PM
Definition of Identifiers:-Identifiers are the names of variables,functions,arrays and classes.They are the user-defined names,consisting of sequence of letters and digits.The underscore is also permitted if u want ,u can use it according to need.Example:- 1.) Class person { }; 2.)void show { ...
Function Overloading
Posted by
Unknown
,
at
3:21:00 PM
#include<iostream.h>#include<conio.h>Int sqr (int);Float sqr (float);Main (){Clrscr ();Int a= 15;Float b = 2.5;Cout <<”Square =”<<<”/n”;Cout <<”Square =”<<<”/n”;Return 0;}Int sqr (int s){Return (s*s);}Float sqr (float j){Return (j*j);}
OUTPUT
Square = 225Square = 6....
Default Arguments
Posted by
Unknown
,
at
3:17:00 PM
C++ lets the programmer to assign default values in the function prototype declaration of the function.When the function is called with less parameter or without parameters the default values are used for the operations .It is not allowed to assign default values to any variables,which is between the variable list.
Example:-
#include<iostream.h>#include<conio.h> int main()
{Clrscr ();int sum (int a, int b=10, int c=15, int d=20);Int a=2;Int b=3;Int c=4;Int d=5;Cout<<”Sum=”<Cout<<”/nSum=”<Cout<<”/nSum=”<Cout<<”/nSum=”<Cout<<”/nsum=”<Return...
Hybrid inheritance
Posted by
Unknown
,
at
3:13:00 PM
Hybrid Inheritance:- It is a combination of two of the inheritance Multiple and hierarchical
Inheritance
Example:-
class A
{
A()
{
Cout<<”I m in A”;
}
};
Class B:public A
{
B()
{
Cout<<”I m in B”;
}
};
class C:public C
{
C()
{
Cout<<”I m in C”;
}
};
Class D:public B,public C
{
D()
{
Cout<<”I m in D”;
}
};
Voi d main()
{
D d;
}
Output:-
I m in A
I m in B
I m in C
I m in...
Hierarchical inheritance
Posted by
Unknown
,
at
3:13:00 PM
Hierarchical Inheritance:-In the Hierarchical Inheritance there is only base class and all
the derived classes are derived from this base class.
Example:-
class A
{
A()
{
Cout<<”I m in A”;
}
};
Class B:public A
{
B()
{
Cout<<”I m in B”;
}
};
class C:public A
{
C()
{
Cout<<”I m in C”;
}
};
Class D:public A
{
D()
{
Cout<<”I m in D”;
}
};
Voi d main()
{
D d;
}
Output:-
I m in A
I m in B
I m in C
I m in...
Multilevel Inheritance
Posted by
Unknown
,
at
3:13:00 PM
Multilevel Inheritance:-In the Multilevel Inheritance there is one base class and other class which is derived from this base class is called derived class. The process of deriving a class from another derived class.
class A
{
A()
{
Cout<<”I m in A”;
}
};
Class B:public A
{
B()
{
Cout<<”I m in B”;
}
};
class C:public B
{
C()
{
Cout<<”I m in C”;
}
};
Class D:public C
{
D()
{
Cout<<”I m in D”;
}
};
Void main()
{
D d;
}
Output:-I m in A
I m in B
I m in C
I m in D ...
Multiple Inheritance
Posted by
Unknown
,
at
3:12:00 PM
Multiple Inheritance:-I n the multiple Inheritance there will be many base classes and there is only one derived class which derives from all the base classes.
Example:-
class A
{
A()
{
Cout<<”I m in A”;
}
};
Class B
{
B()
{
Cout<<”I m in B”;
}
};
class C
{
C()
{
Cout<<”I m in C”;
}
};
Class D:public A,public B,public C
{
D()
{
Cout<<”I m in D”;
}
};
Voi d main()
{
D d;
}
Output:-
I m in A
I m in B
I m in C
I m in...
Single Inheritance
Posted by
Unknown
,
at
3:12:00 PM
Single Inheritance:-In the Single Inheritance there will only one base class and only one derived class.It should be like this.
Example:-
class A
{
A()
{
Cout<<”I m in A”;
}
};
Class B:public A
{
B()
{
Cout<<”I m in B”;
}
};
Voi d main()
{
B b;
}
Output:-I m in A
I m in...
Subscribe to:
Posts (Atom)