Testing a list in a Class

This is a discussion on Testing a list in a Class within the C++ Programming forums, part of the General Programming Boards category; Hi, I'm supposed to implement a class which stores a list and then write a giant, exhausting test list in ...

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    1

    Question Testing a list in a Class

    Hi,

    I'm supposed to implement a class which stores a list and then write a giant, exhausting test list in main.

    I know how to implement the class, but I'm not sure whether that list should be in public or private (I'm assuming public, but not sure), and how to go about creating the list?

    Would it just look like?

    Code:
    class SmList
    {
     private:
       int a, b, c, d, e, f;
    }
    Or did I just miss the class on creating lists in classes?

    Cheers,
    eskEMO

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,340
    >> Or did I just miss the class on creating lists in classes?
    That seems more likely. A list should be allowed to hold more than a set number of objects. Have you learned arrays or pointers yet? Those are the most common ways of storing a list.

    The data in the list should be private, and there should be public functions that allow you to add to the list and get values from the list.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM
  3. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 06:18 AM
  4. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM
  5. singly linked list
    By clarinetster in forum C Programming
    Replies: 2
    Last Post: 08-26-2001, 10:21 PM

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