-
Notifications
You must be signed in to change notification settings - Fork 0
/
classCpp.cpp
72 lines (65 loc) · 1.32 KB
/
classCpp.cpp
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/**
* @file classCpp.cpp
* practicing class and object
* @author Md. Alamin (alamin5g@yahoo.com)
* I would love be a software engineer at Google. That is why anybody can uses this code without any condition, if you face any difficulty, then try to email me.
* @version 0.1
* @date 2022-04-21
*
* @copyright Copyright (c) 2022
*
*/
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
class Students
{
private:
int id, semester;
double sgpa;
string name;
public:
void setName(string name){
this-> name = name;
}
string getName(){
return name;
}
void setSemester(int semester)
{
this->semester = semester;
}
int getSemester()
{
return semester;
}
void setSgpa(double sgpa)
{
this->sgpa = sgpa;
}
double getSgpa()
{
return sgpa;
}
void setId(int id)
{
this->id = id;
}
int getId()
{
return id;
}
};
int main()
{
Students alamin;
alamin.setName("Alamin");
alamin.setId(34);
alamin.setSemester(2);
alamin.setSgpa(3.55);
cout << "Name: "<< alamin.getName()<<endl;
cout << "Id : " << alamin.getId()<< endl;
cout << "Semester : " << alamin.getSemester()<< endl;
cout << "SGPA : " << alamin.getSgpa()<< endl;
return 0;
}