Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why make it a class even, it doesn't hold any state. Also I'd do it like:

DominoTilingCounter tc; std::cout << tc.count(4, 7) << '\n';



Then, count could be a static method, and you wouldn’t need to construct the DominoTilingCounter, yielding

  std::cout << DominoTilingCounter.count(4, 7) << '\n';
That’s close to a free function, using the class only for grouping (say of private helper functions, or for memoization data structures)


In this case you can use a namespace too:

    std::cout << tc::count(4, 7) << '\n';




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: