aliyaawaispk 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();
>
> }
There are a ton of problems with the code, but did you have a specific
purpose for posting? We could nitpick this code to death if that is
what you want. It is a good example of how one should NOT write a
class. Plus, the code won't compile in the first place.
--
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197
*NEW* MyTaskFocus 1.1
Get on task. Stay on task.
http://www.CubicleSoft.com/MyTaskFocus/