Accessing an array from a diffrent class.

If I create a function in one class that returns an array then, in general, how can I assign that return to a new array in a different class? For instance, I created a function that returns an array:

1
2
3
4
5
6
7
8
  std::vector<CTString> Dynamic::versionVector()
  {
    for(int i = 0; i < versions.size(); ++i)
    {
      std::cout << "Firmware Versions: " << versions.at(i) << std::endl;
    }
    return versions;
  }


I imported the header file for the first class into this class and now I am trying to assign the return value of that function to this new array:

1
2
3
    std::vector<CTString> versions;

    versions = Dynamic::versionVector();


however, it is saying: 'versionVector' is not a member of Dynamic
Maybe you spelled versionVector wrong - check your capitalisation.

Maybe you made it private or protected, when it should be public.

If you're still stuck, produce a stripped down Dynamic class with one method versionVector, and one member variable versions.
http://sscce.org/
Registered users can post here. Sign in or register to post.