#include<iostream>
#include<string.h>
#include<cstdlib>
using namespace std;

class student
{
private:
    char name[50];
    int stunum;
    
public:   
    student();
    ~student()
    {
    cout<<"i am destructor"<<endl;
    }

    void setvalue(char *);    
    void display();
};

student::student()
{
//cout<<"i am constructor"<<endl;
    strcpy(name,"\0");
    stunum=0;
}

void student::setvalue(char * a)
{
    strcpy(name,a);
}
void student::display()
{
    cout<<name<<endl;
}


int  main()
{
    student stu1,stu2,stu3;
    //note here..  
    stu1.setvalue("aliya");
    stu1.display();
    
    system("PAUSE");
    return 0;
}

--- In [email protected], "aliyaawaispk" <aliyaawai...@...> wrote:
>
> #include<iostream.h>
> #include<string.h>
> 
> class student
> {
> private:
>    char name[50];
>    int stunum;
> public:
>       
>       student();
>       ~student()
>       {
>               cout<<"i am destructor"<<endl;
>       }
> 
>       void setvalue(char * );
> 
>       void display();
>       
> 
> 
> };
> 
> student::student()
>       {
>               //cout<<"i am constructor"<<endl;
>               strcpy(name,"\0");
>               stunum=0;
>       }
> 
> void student::setvalue(char * a)
>       {
> strcpy(name,a);
>       }
> void student::display()
>       {
> cout<<name<<endl;
>       }
> 
> 
> void main()
> {
>       student stu1,stu2,stu3;
>       stu.setvalue("aliya");
>       stu.display();
>    
> }
>


Reply via email to