By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,972 Members | 1,454 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,972 IT Pros & Developers. It's quick & easy.

In Visual Studio 2017, in C ++ I made a program where I have the error E0427 qualifie

P: 1
Expand|Select|Wrap|Line Numbers
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     class ContBancar {
  6.     private:
  7.         char titular[100];
  8.         char codIBAN[25];
  9.         float sold;
  10.         float ContBancar;
  11.  
  12.     public:
  13.         void init(char _titular[], char _codIBAN[], float _sold);
  14.         void depune(float suma);
  15.         void retrage(float suma);
  16.         float interogareSold();
  17.         void afisare();
  18.  
  19.         void ContBancar::init(char _titular[], char _codIBAN[], float _sold)
  20.         {
  21.  
  22.             strcpy(titular, _titular);
  23.             strcpy(codIBAN, _codIBAN);
  24.             sold = _sold;
  25.         }
  26.         void ContBancar::depune(float suma)
  27.         {
  28.             sold = sold + suma;
  29.         }
  30.         void ContBancar::retrage(float suma)
  31.         {
  32.             sold = sold - suma;
  33.         }
  34.         float ContBancar::interogareSold()
  35.         {
  36.             return sold;
  37.         }
  38.         void ContBancar::afisare()
  39.         {
  40.             printf("Titular:%s\n", titular);
  41.             printf("Cod IBAN:%s\n", codIBAN);
  42.             printf("Sold:%g\n", sold);
  43.         }
  44.     };
  45. system("pause");
  46.     return 0;
  47. }
Oct 29 '19 #1
Share this Question
Share on Google+
1 Reply


100+
P: 142
Scope resolution operator is not used when a function is defined inside the class.

Example:
Expand|Select|Wrap|Line Numbers
  1. class A {
  2.   public:
  3.   void fun(){
  4.     ...
  5.   }
  6.   void fun2(){
  7.     ...
  8.   }
  9. };
  10.  
Also, remove the function declarations since those are not required.
Oct 29 '19 #2

Post your reply

Sign in to post your reply or Sign up for a free account.