本文整理汇总了C++中Person::addCourse方法的典型用法代码示例。如果您正苦于以下问题:C++ Person::addCourse方法的具体用法?C++ Person::addCourse怎么用?C++ Person::addCourse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Person
的用法示例。
在下文中一共展示了Person::addCourse方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mergePeople
bool mergePeople(Person &p1, Person &p2) {
if(p1 == p2) {
p1.addCourse(p2.courses[0]);
return true;
}
else {
return false;
}
}
示例2: main
int main()
{
Person *p = new Student();
p->aboutMe();
p->addCourse("Math");
delete p;
return 0;
}
示例3: main
int main()
{
//Student *s = new Student();
Person *p = new Student();
//s->aboutMe();
p->aboutMe();
p->addCourse("Advance Operating System");
//delete s;
delete p;
cout << sum(4) << endl;
cout << sum(1,2) << endl;
int *ptr = new int;
*ptr = 3;
cout << ptr << endl;
cout << *ptr << endl;
int a = 7;
int &b = a;
b = 12;
cout << a << endl;
ofstream file;
file.open("testFile.txt");
file << "This line will be written on the first line in the file.\n";
file << "This line will be written on the second line in the file.";
file.close();
int lines;
cout << "How many lines from end : ";
cin >> lines;
getLastKLines("4.4.cpp", lines);
return 0;
}