Thread: Collecting Common Functions

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    3

    Question Collecting Common Functions

    After several C++ projects I have several useful functions which I use regularly, such as bubbleSort(), initializeArray(), among others.

    My instructor has said to create a "personal library" of code which can be reused in any situation without a lot of modification.

    My question is, is this said figuratively (must include it in class definition), or can this be done in another simple manner (its own class)?

  2. #2
    Registered User blight2c's Avatar
    Join Date
    Mar 2002
    Posts
    266
    did s/he mean cut and past? i have sometihng like that which i keep on disk

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Make different classes for different type of functions, ie one class for sortings, one for graphics etc...
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  4. #4
    Registered User
    Join Date
    Aug 2001
    Posts
    3
    Make different classes for different type of functions, ie one class for sortings, one for graphics etc...
    Thanks - with some fiddling I was able to get this to work.

    Two questions, though:

    1. Do these library functions need to be set static?

    2. Is there another way to access these methods other than using public or friend?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. calling functions within functions
    By edd1986 in forum C Programming
    Replies: 3
    Last Post: 03-29-2005, 03:35 AM
  2. Factory Functions HOWTO
    By GuardianDevil in forum Windows Programming
    Replies: 1
    Last Post: 05-01-2004, 01:41 PM
  3. Shell functions on Win XP
    By geek@02 in forum Windows Programming
    Replies: 6
    Last Post: 04-19-2004, 05:39 AM
  4. Inline functions and inheritance
    By hpy_gilmore8 in forum C++ Programming
    Replies: 3
    Last Post: 01-14-2004, 06:46 PM
  5. functions - please help!!!!
    By linkies in forum C Programming
    Replies: 1
    Last Post: 08-21-2002, 07:53 AM