1

I want to create a class that is usable without being instanced, but that can also be instanced. Similar to a math class I suppose.

Thanks

jmasterx
  • 52,639
  • 96
  • 311
  • 557
  • 1
    Can you say what you're trying to accomplish? It's hard to be sure that simply adding static methods to a class has anything to do with what you really need. – egrunin Oct 31 '10 at 23:10

2 Answers2

5

If you add static methods to the class, you can call them like this

 ClassName::staticMethod();

You are not stopped from also creating instances of this class.

Lou Franco
  • 87,846
  • 14
  • 132
  • 192
0

A regular class with a constructor with static class functions.

steinar
  • 9,383
  • 1
  • 23
  • 37