Enum type In class.

This is a discussion on Enum type In class. within the C++ Programming forums, part of the General Programming Boards category; I am trying to get an enum type into a class but its not working lol... I left out the ...

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    86

    Enum type In class.

    I am trying to get an enum type into a class but its not working lol...
    I left out the unneeded functions etc to make it more overviewable
    MAIN.CPP
    Code:
    int main ()
    {
      enum group { ADMIN = 1, VIP, MEMBER };
      group Group;
      Group = ADMIN;
    
      std::cout << Group << std::endl;
      member admin ("KaK","email",16,Group);
      std::cout << "lol" << std::endl;
      return 0;
    }
    MEMBER.H
    Code:
    class member
    {
      public:
      member (const std::string,const std::string, int ,enum group  );
      void setgroup     (group);
      group getgroup () const;
      enum TypeAccount {ADMIN = 1, VIP,MEMBER};
    };
    
    #endif
    MEMBER.CPP
    Code:
    member::member (const std::string UN,const std::string EL, int A group.Gr)
    {
      
      setgroup (Gr);
    }
    
    void member::setgroup (enum group Gr)
    {
     TypeAccount = Gr;
    }
    group member::getgroup () const { return (TypeAccount); }
    i basicly need some help to implement an enum type in my class
    , this are my (current) errors:

    "member.cpp": E2293 ) expected at line 3
    "Main.cpp": E2285 Could not find a match for 'member::member(char *,char *,int,group)' in function main() at line 10

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    Code:
    enum TypeAccount {ADMIN = 1, VIP,MEMBER};
    This is a redeclaration, you need a member of type group.

    Code:
    group TypeAccount;
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    Registered User
    Join Date
    Nov 2006
    Posts
    86
    Oh ok

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. failure to import external C libraries in C++ project
    By nocturna_gr in forum C++ Programming
    Replies: 3
    Last Post: 12-02-2007, 02:49 PM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM
  4. Erros in Utility Header File
    By silk.odyssey in forum C++ Programming
    Replies: 4
    Last Post: 12-22-2003, 05:17 AM
  5. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 06:49 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21