-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.h
61 lines (54 loc) · 1.19 KB
/
main.h
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
#ifndef __MAIN_H__
#define __MAIN_H__
#include <gmock/gmock.h>
#include <iostream>
int myFunction(int x );
int setConfig(std::string deviceName, std::string flag);
class StuBase{
public:
StuBase(int age, std::string name){
this->age = age;
this->name = name;
}
void setName(std::string name)
{
this->name = name;
}
virtual bool lessonList(std::string& name, std::string &list) = 0;
std::string getName(){
return name;
}
~StuBase(){
}
bool displayLessonsList(StuBase *sPtr){
std::cout << "Calling displayLessonsList...\n";
std::string name, lessons;
return sPtr->lessonList(lessons, name);
}
private:
int age;
std::string name;
};
class Primary: public StuBase{
public:
Primary(int age, std::string name, std::string lessons = ""): StuBase(age, name){
this->lessons = lessons;
}
~Primary(){
}
void setLessons(std::string & lessons)
{
this->lessons = lessons;
}
bool lessonList(std::string & name, std::string& list){
std::cout << "Lessons list from Primary Student: " << lessons << ".\n";
if(lessons.empty())
return false;
list = lessons;
name = this->getName();
return true;
}
private:
std::string lessons;
};
#endif