Search code examples
c++classmethodscompiler-errorsturbo-c++

<function> is not a member of <class>


I have declared my function 'Credit' as a private member with some arguments. My observation is that whenever I try to compile without any argument the compiler will compile successfully. but as soon as I compile with the arguments in the function, the compiler gives an error

'Transaction :: Credit' is not a member of 'Transaction'

Here is my code

class Transaction : public Menu
{
private :

    void Credit(int depost);//{ return 0;}

public :
    void Deposit();
    void Withdraw(){}
    void Transfer(){}
};

void Transaction :: Deposit()
{
       char custid[10]; int deposit;

       clrscr();
       cout << endl << endl << endl << endl << endl;
       cout << "\t\t\t\t  DEPOSIT " << endl;
       cout << "\t\t   Please enter your Customer ID" << endl;
       cin  >> custid;
       cout << "\t\t   Please enter the amount you want to deposit (in Rupees)" << endl;
       cin  >> deposit;

 //      Credit (depost);
}

void Transaction :: Credit (depost)
{

}

I am using Turbo C++, so please guide me according this IDE.


Solution

  • You're missing the type of depost:

    void Transaction :: Credit (int depost)