Thread: Error in Dev C++...

  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    14

    Question Error in Dev C++...

    Code:
    #ifndef SALES_H_
    #define SALES_H_
    
    namespace SALES {
        
        const int QUARTERS = 4;
        class Sales {
            private:
                double sales[QUARTERS];
                double average;
                double max;
                double min;
            public:
                // default constructor
                Sales();
                Sales(const double ar[], int n);
                ~Sales();
                void showsales() const;
        };
    }
    #endif
    I keep getting this error message:
    sales.h `double SALES::Sales::sales[4]' is private

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    That's because it is. You've got the word private right there on the line before. You can't use private members of a class outside the class.

  3. #3
    Registered User
    Join Date
    Feb 2009
    Posts
    14
    Quote Originally Posted by tabstop View Post
    That's because it is. You've got the word private right there on the line before. You can't use private members of a class outside the class.
    My thing is the solution code looks the same in terms of the location of the QUARTERS constant.

  4. #4
    Registered User
    Join Date
    Feb 2009
    Posts
    14
    Ok, I got it. The real problem was in main 'sales' instead of 'Sales'...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Whats better, C-Free or Dev C++??
    By i_can_do_this in forum Tech Board
    Replies: 10
    Last Post: 07-07-2006, 04:34 AM
  2. New to Dev C++/<windows.h>...
    By Cilius in forum C++ Programming
    Replies: 3
    Last Post: 02-23-2005, 01:05 AM
  3. Glut and Dev C++, Programs not Quitting?
    By Zeusbwr in forum Game Programming
    Replies: 13
    Last Post: 11-29-2004, 08:43 PM
  4. DEV C++ Limitations?
    By Kirdra in forum Game Programming
    Replies: 3
    Last Post: 09-09-2002, 09:40 PM
  5. Tutorial about Bloodshed Dev!
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 11-13-2001, 07:42 PM