Tuesday, 11 March 2014

Use Of Pointer ,Allocate Memory Using New Keyword

#Include<iostream.h>

Class TestClass
{
Char Name[30];
int Telephone_No;

Public:
          Void Input();
         Void Display();
}
Void Main()
{
TestClass *ob;
ob=new TestClass;
ob.Input();
ob.Display();
}

Void TestClass::Input()
{
cout<<"Enter The Name:-";
cin>>Name;
cout< <"\nEnter The Phone No:-";
cin>>Telephone_No;
} 

Void TestClass::Display()
{
cout<<"\nThe Name Is:"<<Name;
 cout<<"\nThe Phone No:"<<Telephone_No;
}

No comments:

Post a Comment