Carefully understand the code given bellow. Analyze the code and suggest any corrections needed with reason.There may be syntax and logical errors.
Carefully understand the code given bellow. Analyze the code and suggest any corrections needed with reason.There may be syntax and logical errors.
Class Student
{
int age;
char cnic;
int semester;
char name;
private:
int setall(int a, int c, int s, int sem, char n) const ;
{
age=a;
c=cnic;
semester=s;
name=n;
}
void Student(int age, char cnic, int semestser, char name)
{
age =age; cnic=cnic; semester=semester; name =name;
}
}//;
public:
int student : displayall ( ) const ;
{
cout<<Age<<endl;
cout<<Name<<endl;
cout<<Semester<<endl;
cout<<Cnic<<endl;
}
int main( )
{
student 3obj(3,4,5,2);
obj 3:: setall( );
obj3 : displayall(int s, char c, char n, int s );
3obj . setage( );
student obj2;
student::obj2.setall(int c, char a, char p, int c );
return 0;
}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images