64,648
社区成员
发帖
与我相关
我的任务
分享
Student(const string &sname, Discipline d,const shared_ptr<Person> &adv) :Person(sname), major(d), advisor(adv) {}
shared_ptr<Faculty> prof = make_shared<Faculty>("Indiana Jones", Discipline::ARCHE0LOGY);
shared_ptr<Student> st = make_shared<Student>("Sean Bolster", Discipline::ARCHE0LOGY, prof);
#include<iostream>
using namespace std;
void kk(shared_ptr<int> &y)
{
cout << *y << endl;
}
void kk(unique_ptr<int> &y)
{
cout << *y << endl;
}
//void kk(int& *ptr)
//{
//}
int main()
{
int y = 7;
shared_ptr<int> x = make_shared<int>(y);
unique_ptr<int> z = make_unique<int>(y);
int *p = &y;
kk(x);
kk(z);
//kk(p);
return 0;
}