The code FLATMATE resident;
creates an instance of FLATMATE. It is called an object. Whenever you create a DUTY object, inside that duty object, is an instance of FLATMATE. So each DUTY object has a FLATMATE object. Its similar to this:
class DUTY{
int resident;
}
the only difference is that instead of it being an int, it is of type FLATMATE. You can initialize FLATMATE object in the constructor of DUTY.