// class scope-resolution #include<iostream> using namespace std; class abc { int roll; char name[10]; public: void set(); void get(); }; void abc::set() // use the scope resolution { cout<<"Enter your roll no :"; cin>>roll; cout<<"Enter your name :"; cin>>name; } void abc::get() // use the scope resolution { cout<<"your roll no is :"<<roll<<"\n"; cout<<"your name is :"<<name<<"\n"; } int main() { abc st; st.set(); st.get(); }
Enter your roll No : 109 Your roll No is:109
0 Comments