Ok guys I need some help with this code. I'm suposed to run this problem with it:

  • Rewrite the program to include a static data member named numemps. This variable, which should be an integer, shoud act as a counter that is initialized to zero, and is incremented by the class constructor each time a new object is declared. Rewrite the static function disp() to display the value of this counter.
  • Revise the main() function call disp() after each Employee object is created.
  • Compile the program and correct any syntax errors that are identified.
  • Run the program and verify that it displays the value of the static variable after each object is created.

I ran and compiled and I'm getting this error:
no matching function for call to `Employee::disp()'

And I dont understand why. As you can tell I'm a new at this.

#include <iostream> 
using namespace std;

class Employee
{
  // data declaration section
  private:
    static double taxRate;
    int idNum;
    static int numemps;

  // method declarations
  public:
    Employee(int = 0);    // constructor
    void display();      // access function
    static void disp( int numemps );  // static function
};

// static member definition
double Employee::taxRate = 0.07;   // this defines taxRate

// implementation section

Employee::Employee(int num)
{
  idNum = num;
}

void Employee::display()
{
  cout << "Employee number " << idNum
       << " has a tax rate of " << taxRate << endl;
}

void Employee::disp( int numemps )
{
  cout << "The static tax rate is " << taxRate << endl;
}

int main()
{
  Employee::disp();   // call the static functions
  Employee emp1(11122), emp2(11133);

  emp1.display();
  emp2.display();
 
  system( "PAUSE" ); 
  return 0;
}

I sorry about that. I was trying to edit.

And watch your
titles
and your CODE tags

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.