#include <iostream>
using namespace std;
class student{
private:
int rollno;
string name;
int age;
public:
void getdetails(){
cout<<"enter data"<<endl;
cin>>rollno>>name>>age;
cout<<name<<endl
<<rollno<<endl
<<age<<endl;
}
};
int main() {
student s1;
s1.getdetails();
return 0;
}
//encapsulation---> wrapping of data members( and member functions in
// a single unit is called encapsulation.Data members
// and member functions are tightly bounded ,i.e they
// both should be inside the same class...(single unit).
To embed this project on your website, copy the following code and paste it into your website's HTML: