#include <iostream>
using namespace std;
//we create a new class
class student {
public:
string n;
//getter setter like java
// we create a methods
void setName(string name)
{
n = name;
}
void getName ()
{
cout<<"your name is "+n;
}
};
int main()
{
student s1;
s1.setName("vikas");
s1.getName();
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: