Source Code
#include<iostream>#include<conio.h>
using namespace std;
class student{
public:
string name;
void intro(); //function
};
void student::intro(){
cout<<"Name of Student:"<<student::name<<endl;
}
int main(){
student student1; //creating object
student1.name="john";
student1.intro(); /*calling function ,you can call
this function as m
any times as you want"*/
getche();
}
No comments: