Thread: "group"

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

    "group"

    I have a class called member. which has some get&set functions for email and name etc.
    but i also want to make some kind of "GROUP" data member, in this case the member either is a normal member, a VIP or an ADMIN. if u get my point... but how do i achieve this? i wouldnt want to go with just strings i was thinking of using some kind of struct? or... i cant realy find a good idea.

    I am also going to save the class in binary, so i think a struct would work

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    I'd use enum
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  3. #3
    Registered User
    Join Date
    Nov 2006
    Posts
    86
    how do i use this type enum?

  4. #4
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Code:
    enum Group {Normal, Admin, VIP};
    Maybe?
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  5. #5
    Registered User
    Join Date
    Nov 2006
    Posts
    86
    might u know a full tutorial on ENUM? so i know everything

  6. #6
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

Popular pages Recent additions subscribe to a feed