#include<iostream>
using namespace std;
class prime{
public:
int id; //Data Member
string name; //Data Member
prime(int value, string s_name){//Parameterized Constructor
id = value;
name = s_name;
}
void display(){
cout<<"Id is: "<<id<<endl;
cout<<"Name is: "<<name<<endl;
}
};
int main()
{
int num;
string name;
cin>>num;
cin>>name;
// prime obj(120, "Bangladesh");
prime obj = prime(num, name);
obj.display();
return 0;
}
Youtube video link: https://www.youtube.com/watch?v=fEnIx3lbXO4&list=UUkE_J-tXiqxzASO6nlB8D6w&index=2
No comments:
Post a Comment