-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoops1
36 lines (32 loc) · 940 Bytes
/
oops1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include<iostream>
#include<string.h>
using namespace std;
using std::string;
class Student {
public:
string Name;
string Fathersname;
long Rollno;
//blueprint or attributes
void Greetings(){
std::cout<<"Name - "<<Name<<std::endl;
std::cout<<"Fathersname - "<<Fathersname<<std::endl;
std::cout<<"Rollno - "<<Rollno<<std::endl;
//methods as it helps to do a function again and again without copying and pasting
}
Student(string name,string fathersname,int rollno) {
Name = name;
Fathersname = Fathersname;
Rollno = rollno;
}
};
//creating object;
int main()
{ /* Student student1;
student1.Name = "Yasahsvi";
student1.Fathersname = "Manoj KUmar Singh";
student1.Rollno = 2000290310196;
student1.Greetings();*/
Student student1 = Student("Yasahsvi","Manoj KUmar Singh",2000290310196);
student1.Greetings();
}