Thread: staitc class

  1. #16
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    I JUST TOLD YOU!!
    Are you stupid?

    Can someone close this thread? For pete's sake!
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  2. #17
    the Great ElastoManiac's Avatar
    Join Date
    Nov 2005
    Location
    Republika Srpska - Balkan
    Posts
    377
    I'm not the one who's stupid, 'cause you haven't explained what that is. And you are pretending you are. Your stupid !
    lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu

  3. #18
    the Great ElastoManiac's Avatar
    Join Date
    Nov 2005
    Location
    Republika Srpska - Balkan
    Posts
    377
    "read on static data members" is that your explanation. It's very informative! It doesn't even form a sentence !
    lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu

  4. #19
    Registered User
    Join Date
    Jun 2004
    Posts
    201
    Quote Originally Posted by ElastoManiac
    so how do you acsses it ?
    You still have to create and instance of the class in every *.cpp file your using it in...
    just learn about how static member functions work.

    You call it like

    Single &instance = Single::instance();

  5. #20
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    I'm calling for a boycott on this lazy bum. Cool it Mario. If he's not getting it, he will someday...
    Code:
    #include <stdio.h>
    
    void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){
    puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9
    /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i]
    ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][
    t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}

  6. #21
    the Great ElastoManiac's Avatar
    Join Date
    Nov 2005
    Location
    Republika Srpska - Balkan
    Posts
    377
    all you can say is " he can't understand it "
    you'r not a good source of information, goodbye.
    lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu

  7. #22
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    Wow, I have never seen such a heated debate.

    One example of a static data member:


    Code:
    class Foo
    {
    public:
       Foo() {};
       ~Foo() {};
       
       static int s_data; // static data member
    
       // static member function
       static int getData()
       {
          return s_data;
       }
    };
    
    // initalize static data member
    int Foo::s_data = 0;
    I am not sure if that example is what you are looking for, but usually
    all static class member functions are defined as shown. I do not want
    to get caught up in the debate with you and mario, I am just trying to
    understand the problem. Of course, you are free to ignore this post if it
    is not want you were after.





    private
    Double Helix STL

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Class design problem
    By h3ro in forum C++ Programming
    Replies: 10
    Last Post: 12-19-2008, 09:10 AM
  2. Specializing class
    By Elysia in forum C++ Programming
    Replies: 6
    Last Post: 09-28-2008, 04:30 AM
  3. matrix class
    By shuo in forum C++ Programming
    Replies: 2
    Last Post: 07-13-2007, 01:03 AM
  4. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM