how do i get the vector array vBase2
to pass through the parameter add(vBase2)
add the value 2 to the vector
and then recieve the value in main class
so the output is:
worked
0
Add
1
worked
1
// main class
//headerCode:vector<int> vBase2; int main() { cout << "Worked" << endl; //vBase2.push_back(1); cout << vBase2.size() << endl; system("PAUSE"); firstcl fc; fc.Add(vBase2); cout << "Worked" << endl; cout << vBase2.size() << endl; system("PAUSE"); return 0; }
Code:class firstcl { public: void Add(vector<int> vBase2); };
// cpp
output is:Code:void firstcl::Add(vector<int> vBase2) { vBase2.push_back(2); cout << "Add" << endl; cout << vBase2.size() << endl; system("PAUSE"); }
worked
0
Add
1
worked
0




Reply With Quote