class student
{
private :
int rollno;
char name[20];
public:
void change_stud()
{ cout<<"enter new roll no:";
cin>>rollno;
cout<<" new name ";
cin.getline(name,20);
}
void show_student()
{ cout<<rollno<<" "<<name;}
}
さて、外部関数の例からそれらを表示または変更できる場合、クラスの非表示のメンバーがどのようroolno
になっているのかを説明してくださいname
main()
int main()
{
student s1;
s1.change_stud();
s1.show_student();
}
クラスでのデータの隠蔽と抽象化の基本的な意味は何ですか? クラスのプライベートメンバーに実際にアクセスできる場合でも。