C++ Concept of Class and Object Simple Program - HelpMeOutAlways

Wednesday, October 3, 2018

C++ Concept of Class and Object Simple Program

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();
}

Output

OOP

No comments:

@way2themes