Website Summary Files Commits Branches @commit @diff @stats
path: root / Big4 / InformaticsStudent.h
blob: 7477b2b48055eaa7cf0d37673c525b272b3d6f93 (plain) (blame)
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

// Голямта 4-ка - Функции, които трябва да разпишем, САМО когато имаме динамична памет в класа.

// 1.Defualt constructor InformaticsStudent();
// 2.Copy-constructor InformaticsStudent(const InformaticsStudent& other); 
// 3.operator=  InformaticsStudent& operator=(const InformaticsStudent& other);
// 4.Destructor ~InformaticsStudent()
// (Най-лесно е като си разпишем функция за копиране CopyFrom  и функция за триене Free())

class InformaticsStudent
{
private:
	char* name;
	int fn;

	void CopyFrom(const InformaticsStudent& other);
        void Free();

public:
	/// BIG 4 starts here
	
	InformaticsStudent();
	InformaticsStudent(const InformaticsStudent& other);
	InformaticsStudent& operator=(const InformaticsStudent& other);
	~InformaticsStudent();
	// BIG 4 ends here

	InformaticsStudent(const char* name, int fn);
	
	void setName(const char* name);
	void setFn(int fn);
	const char* getName() const;
	int getFn() const;
	
	void printStudent();
	
};