Nested Member In cpp
Nested Member In cpp
PROGRAM:
#include<iostream> using namespace std; class student{ char name[10]; int roll_no; void print(){ cout<<"\n\n Entered Name : "<<name<<"\n\n Entered roll no : "<<roll_no; } public: void setdata(){ cout<<"\nEnter name : "; cin>>name; cout<<"\nEnter roll no : "; cin>>roll_no; print(); //!nesting of member function } }; int main(){ student s; s.setdata(); return 0; }
Comments
Post a Comment