unions in a class

This is a discussion on unions in a class within the C++ Programming forums, part of the General Programming Boards category; just wondering can i put a union as member data in a class or can i even put a struct ...

  1. #1
    O'Conner
    Guest

    unions in a class

    just wondering can i put a union as member data in a class or can i even put a struct
    an example would be say my class was a cook and some of his data included a list of all of the recipies he new as well as his age and all that other junk
    the reason i say union is because only one recipie would have to be obtained at a time
    thanks for any help

  2. #2
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    A union, structure, or class can be used as a member of a class.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Class design problem
    By h3ro in forum C++ Programming
    Replies: 10
    Last Post: 12-19-2008, 09:10 AM
  2. Specializing class
    By Elysia in forum C++ Programming
    Replies: 6
    Last Post: 09-28-2008, 05:30 AM
  3. matrix class
    By shuo in forum C++ Programming
    Replies: 2
    Last Post: 07-13-2007, 02:03 AM
  4. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 03:39 PM
  5. Abstract class problem
    By VanJay011379 in forum C++ Programming
    Replies: 9
    Last Post: 07-31-2002, 02:30 PM

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