mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2025-12-18 21:24:41 +03:00
Extended Sd-factory example per issue #310
This commit is contained in:
@@ -13485,7 +13485,17 @@ Here is an example of the last option:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class D : public B { /* "¦ */ }; // some derived class
|
|
||||||
|
class D : public B { // some derived class
|
||||||
|
public:
|
||||||
|
void f() override { /* ... */ };
|
||||||
|
|
||||||
|
protected:
|
||||||
|
D() {}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
friend shared_ptr<T> B::Create();
|
||||||
|
};
|
||||||
|
|
||||||
shared_ptr<D> p = D::Create<D>(); // creating a D object
|
shared_ptr<D> p = D::Create<D>(); // creating a D object
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user