what do we do with this? is there some problem somewhere?
Also, unless I missed it, you need a using namespace std, or you need to 
reference the namespace for cout.


Thanks,
Tyler Littlefield
Web: tysdomain.com
email: [email protected]
My programs don't have bugs, they're called randomly added features.

----- Original Message ----- 
From: "aliyaawaispk" <[email protected]>
To: <[email protected]>
Sent: Tuesday, June 09, 2009 2:14 AM
Subject: [c-prog] class code example


#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