Thanks all, I've taken on board your kind suggestions and re-worked the above using vector and iterator, this was useful learning.
For those still interested, code below:
Code:
#include<iostream>
#include<vector>
using namespace std;
const int MEMB = 3;
class Dog{
private:
string m_name;
int m_age;
public:
Dog():m_name("doggy"), m_age(0){}
void setDog();
void showDog();
};
int main(){
vector<Dog> list (MEMB);
for (vector<Dog> ::iterator it = list.begin(); it != list.end(); ++it){
(*it).setDog();
cout<<endl;
}
cout<<endl;
for (vector<Dog>::iterator it = list.begin(); it != list.end(); ++it){
(*it).showDog();
cout<<endl;
}
}
void Dog::setDog(){
cout<<"Enter dog's name: ";
string name;
cin>>name;
m_name = name;
cout<<"Enter dog's age: ";
int age;
cin>>age;
m_age = age;
}
void Dog::showDog(){
cout<<"The dog's name is: "<<m_name<<endl;
cout<<"The dog's age is: "<<m_age<<" years"<<endl;
}