/
githubmirror
/
CPlusPlusThings
Обзор
Документация
Войти
/
githubmirror
/
CPlusPlusThings
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
codingStyleIdioms/5_pImpl/pimpl.cpp
48 строк
522 B
Light-City
update
12 дек 2019, 11:09
12 дек 2019, 11:09
4f149ee
Код
Авторство
О чём код?
// // Created by light on 19-12-9. // #include <iostream> using namespace std; // pImpl: Pointer-to-Implementation class private_foo; class foo { public: foo(); ~foo(); void bar(); private: private_foo *pImpl; }; class private_foo { public: void bar() { cout<<"private_foo invoke bar funciton."<<endl; } private: int m1; string m2; }; foo::foo() : pImpl(new private_foo()) { } foo::~foo() { } void foo::bar() { pImpl->bar(); } int main() { foo f; f.bar(); }