×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Regular Contributor
    Join Date
    Aug 2010
    Posts
    347

    illegal name overloading

    Hello,

    This is not specifically a Symbian C++ query, but is related to C++ in general.

    I ran into the following error in my code:

    illegal name overloading

    And what caused this was the repeated use of the same value, none, in two different enum declarations:

    Code:
    enum A
    {
    ...
    none
    };
    
    enum B
    {
    none,
    ....
    }
    I would appreciate your thoughts.

    TIA
    Vin

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    India
    Posts
    1,173

    Re: illegal name overloading

    I think it will depend on the Location where you are trying to define these two Enums i.e. Scope. If you are trying to define them in a single class then they will not work. But if tried in two different classes (obviously in the same application) then they should work.

  3. #3
    Regular Contributor
    Join Date
    Aug 2010
    Posts
    347

    Re: illegal name overloading

    I am declaring these two enumerations as outside of any class, and using variables of their type in the same class.

    For example

    Code:
    enum A
    {
    ....
    none
    };
    
    enum B
    {
    none,
    ....
    };
    
    class C
    {
    A a;
    B b;
    };
    But I am getting the error in the header file itself, where the enums are declared outside any class scope.

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,692

    Re: illegal name overloading

    An enumeration is not a container, it does not provide a scope. Thus "none" is declared twice, and that is the problem.

    It is good to know and good to remember. There was a thread where someone was developing a code for years, and it worked on everything up to S60 3rd FP1 (including S60 2nd editions too). Then S60 3rd FP2 came, and introduced some enumerations in the middle of the camera engine, clashing with his own ones. That was a slightly mystical one to find out, but it was exactly the same thing you are depicting here.

  5. #5
    Regular Contributor
    Join Date
    Aug 2010
    Posts
    347

    Re: illegal name overloading

    Thanks for the info.

Similar Threads

  1. illegal function overloading
    By iron94 in forum Symbian
    Replies: 2
    Last Post: 2010-04-06, 09:42
  2. Overloading new opearator
    By Shilpa13 in forum Symbian
    Replies: 3
    Last Post: 2009-05-16, 09:18
  3. Replies: 3
    Last Post: 2007-11-06, 14:39
  4. overloading delete operator
    By mihirg in forum Symbian
    Replies: 3
    Last Post: 2007-10-09, 09:02
  5. Overloading of addCommand()
    By namrata in forum Mobile Java General
    Replies: 8
    Last Post: 2007-02-21, 12:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×