how to define a class with features like c#'s static class?
#1 Members - Reputation: 193
Posted 18 December 2012 - 01:04 PM
i am new to c++ OOP. how do i define a C#'s static class where i can define a set of static methods to be used in C++? i came across a website that said i can use CBox::show(); to call the method show in class CBox, but i forget about the details and where the website is. can someone send me a link or an example?
thanks.
#2 Members - Reputation: 751
Posted 18 December 2012 - 01:06 PM
There are no static constructors though. So you have to take care of that some where.
Because there are no static ctor, you maybe just use a singleton.
Edited by EddieV223, 18 December 2012 - 01:07 PM.
If this post was helpful and/or constructive please give rep.
SFML2.0 Nightly Download Link http://en.sfml-dev.org/forums/index.php?topic=9513.0
SFML2.0 Tutorials http://www.sfml-dev.org/tutorials/2.0/
#3 Members - Reputation: 193
Posted 18 December 2012 - 01:39 PM
[source lang="cpp"]class MyStaticClass{public:static int myInt;static void MyFunc();};[/source]
There are no static constructors though. So you have to take care of that some where.
Because there are no static ctor, you maybe just use a singleton.
thanks
#4 Members - Reputation: 419
Posted 19 December 2012 - 03:33 AM






