When should I use static methods in a class and what are the benefits?

前端 未结 10 1437
孤独总比滥情好
孤独总比滥情好 2020-11-27 12:34

I have concept of static variables but what are the benefits of static methods in a class. I have worked on some projects but I did not make a method static. Whenever I need

10条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-27 13:03

    One common usage of static methods is in the named constructor idiom. See: http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.8.

提交回复
热议问题