| | | | | |

Static Member Functions 1

  • Can be called from the class level (with no objects created) using scope resolution
  • Can be called from any object using dot notation
  • May access static class data
  • May not access non-static data in an object
  • class IntArray
    {
    public:
      ...
      static unsigned int ObjectCount ();
    private:
      ..
      static unsigned int objectCount_;
    } ;
    
    unsigned int IntArray::ObjectCount ()
    {
      return objectCount_;
    }
    

| | Top of Page | 6. C++ Classes Part 2: Advanced Features - 19 of 22