Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <vector>
- struct MyClassImpl
- {
- std::vector<int> vec;
- }
- ref class MyClass
- {
- MyClassImpl* impl;
- public:
- MyClass(const int n):
- impl(new MyClassImpl)
- {
- impl->vec.resize(n, 0);
- }
- ~MyClass()
- {
- delete impl;
- }
- };
- // Alternativamente
- struct MyOtherClassImpl
- {
- std::vector<int> vec;
- MyOtherClassImpl(const int n):
- vec(n)
- {}
- }
- ref class MyOtherClass
- {
- MyOtherClassImpl* impl;
- public:
- MyOtherClass(const int n):
- impl(new MyOtherClassImpl(n))
- {
- }
- ~MyOtherClass()
- {
- delete impl;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement