cannot call member function without object
<p>This program has the user input name/age pairs and then outputs them, using a class.
Here is the code.</p>

<pre><code>#include "std_lib_facilities.h"

class Name_pairs
{
public:
       bool test();
       void read_names();
       void read_ages();
       void print();
private:
        vector&lt;string&gt;names;
        vector&lt;double&gt;ages;
        string name;
        double age;
};

void Name_pairs::read_names()
{
     cout &lt;&lt; "Enter name: ";
     cin &gt;&gt; name;
     names.push_back(name);
     cout &lt;&lt; endl;
}

void Name_pairs::read_ages()
{
     cout &lt;&lt; "Enter corresponding age: ";
     cin &gt;&gt; age;
     ages.push_back(age);
     cout &lt;&lt; endl;
}

void Name_pairs::print()
{
     for(int i = 0; i &lt; names.size() &amp;&amp; i &lt; ages.size(); ++i)
             cout &lt;&lt; names[i] &lt;&lt; " , " &lt;&lt; ages[i] &lt;&lt; endl;
}

bool Name_pairs::test()
{
   int i = 0;
   if(ages[i] == 0 || names[i] == "0") return false;
   else{
        ++i;
        return true;}
}


int main()
{
    cout &lt;&lt; "Enter names and ages. Use 0 to cancel.\n";
    while(Name_pairs::test())
    {
     Name_pairs::read_names();
     Name_pairs::read_ages();
     }
     Name_pairs::print();
     keep_window_open();
}
</code></pre>

<p>However, in int main() when I try to call the functions I get "cannot call 'whatever name is' function without object." I'm guessing this is because it's looking for something like variable.test or variable.read_names. How should I go about fixing this?       </p>
