Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <sstream>
- class Utl
- {
- public:
- // singleton accessor
- static Utl& GetInstance();
- virtual std::string GetHello( bool full ) = 0;
- };
- class UtlImpl : public Utl
- {
- public:
- UtlImpl() {}
- virtual std::string GetHello( bool full )
- {
- return (full)?"full":"partial";
- }
- };
- Utl& Utl::GetInstance()
- {
- static UtlImpl instance;
- return instance;
- }
- int main( int argc, char* argv[] )
- {
- std::cout << Utl::GetInstance().GetHello(true) << std::endl;
- std::cout << Utl::GetInstance().GetHello(false) << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement