Home / utk / cs102 / fa16 / labf / code_snippets / class_demonstration.cpp
Directory Listing
misc
circle.cpp
class_demonstration.cpp
layout.cpp
simple_class_example.cpp
student_class_example.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
#include <iostream>

using namespace std;

class thing {
	public:
		void print();
		void setA(int);
		void setB(int);

		int getA();
		int getB();

	private:
		int a, b;
};

int main() {
	int a, b;
	thing object;

	object.setA(a);
	object.setB(b);
}

void thing::setA(int val) {
	a = val;
}

void thing::setB(int val) {
	b = val;
}

int thing::getA() {
	return a;
}

int thing::getB() {
	return b;
}