An array of objects is and could be constructed exactly like how we create an array of int or other datatypes.
#include <iostream>
#include <string.h>
#include <conio.h>
using namespace std;
class Employee
{
string name;
int salary;
public:
void setinfo(void)
{
cout << "Enter Your Name " << endl;
cin >> name;
salary = 12000;
}
void getinfo(void)
{
cout << "You Name is " << name << " Salary is " << salary << endl;
}
};
int main()
{
// Employee laiba ;
// laiba.setinfo();
// laiba.getinfo();
Employee emp[4];
for (int i = 0; i <= 4; i++)
{
emp[i].setinfo();
emp[i].getinfo();
};
return 0;
}