Function Parameters

This is a discussion on Function Parameters within the C++ Programming forums, part of the General Programming Boards category; Is there anyway to pass an array of classes to a function in c++???...

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    7

    Function Parameters

    Is there anyway to pass an array of classes to a function in c++???

  2. #2
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    I assume you mean an array of one particular class. If so, then its the same way you pass any other array:
    Code:
    void myfunction(myclass []);

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    All the solution the others have presented pertain to class objects, not classes. You cannot pass class in C++, only class objects.

    You should implement the solutions above.

    Kuphryn
    Last edited by kuphryn; 11-14-2002 at 03:02 AM.

  4. #4
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Or far better - std::vector passed by reference

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 05-13-2011, 09:28 AM
  2. function with variable number of parameters
    By mikahell in forum C++ Programming
    Replies: 3
    Last Post: 07-23-2006, 04:35 PM
  3. Change this program so it uses function??
    By stormfront in forum C Programming
    Replies: 8
    Last Post: 11-01-2005, 08:55 AM
  4. C++ compilation issues
    By Rupan in forum C++ Programming
    Replies: 1
    Last Post: 08-22-2005, 06:45 AM
  5. Replies: 5
    Last Post: 02-08-2003, 07:42 PM

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