Date: 2010-02-11 04:13 am (UTC)
>как передача интерфейса поможет заменить синглтон?
Было:
void MyClass::foo()
{
   ... bla-bla
   OurCoolUtils::Logger::getInstance()->write("Finish bla");
   ... boo-boo
}

Стало:
MyClass::MyClass(........, ILogger* logger) 
  : .... logger(logger)
{
  ...
}

void MyClass::foo()
{
   ... bla-bla
   logger->write("Finish bla");
   ... boo-boo
}

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

May 2025

S M T W T F S
    1 2 3
456 7 8 9 10
11 121314151617
181920 21 222324
25 262728 293031

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated May. 29th, 2025 07:15 pm
Powered by Dreamwidth Studios