#include <iostream>
#include<cstring>
using namespace std;
class Demo {
private:
long mno;
char name[10];
public:
void setMyInfo(long mno, char *name){
this->mno =mno;
strcpy(this->name,name);
}
void displayMyInfo(){
cout<<"Name: "<<name<<endl;
cout<<"your mobile no: "<<mno;
}
};
int main(){
Demo obj;
obj.setMyInfo(9875246115, "Rajesh");
obj.displayMyInfo();
return 0;
}
output:
Name: Rajesh
your mobile no: 9875246115
0 Comments
Post a Comment