<function> is not a member of <class>

29,242

You're missing the type of depost:

void Transaction :: Credit (int depost)

And it is considered bad practice to start the name of functions with a capital letter. The names of classes should start with capital letters. Functions and variables should have names that start with lowercase letters.

Share:
29,242
Swanav
Author by

Swanav

Senior Firmware Engineer at Eran Group, working on the connected products. Languages : C, C++, Dart, JavaScript, Typescript.

Updated on July 09, 2022

Comments

  • Swanav
    Swanav almost 2 years

    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.