passing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • steele20
    New Member
    • Sep 2006
    • 6

    #1

    passing

    Hello, I got a main with


    void main()
    {
    int i =0;
    int finalarray[30];
    inputfile( finalarray, &i);
    }

    and I want to pass finalarray to class vacuumcleaner, not sure how to do this because I keep getting errors. Wouldn't it be something like.

    void main()
    {
    int i =0;
    int finalarray[30];
    inputfile( finalarray, &i);
    vacuumcleaner stuff(finalarra y);
    stuff.sortingnu mbers();

    }

    class vacuumcleaner
    {
    public:
    vacuumcleaner(f inalarray);
    void sortingnumbers( n, m, c);
    private:
    int n, m, c;
    };
  • zeny
    New Member
    • Jul 2006
    • 44

    #2
    Maybe you´re getting errors because in the vaccumCleaner class the methods and constructors signatures lack the argument types. I think it should be:

    class VacuumCleaner{

    public:
    vacuumcleaner(i nt finalarray[]);

    ....

    }

    Comment

    • Banfa
      Recognized Expert Expert
      • Feb 2006
      • 9067

      #3
      you may also wish to pass the size of finalarray to the vaccumcleaner class unless it is fixed as a program wide constant.

      Comment

      Working...