#include <iostream>
#include <string>

#include "job.h"

Job::Job(int id, std::string machine_name)
    : job_id(id), state(State::Moveable), machine(machine_name)
{
    std::cout << "Created new job: " << id << std::endl;
}

int Job::get_id() const
{
    return job_id;
}

const std::string& Job::get_machine() const
{
    return machine;
}

bool Job::moveable() const
{
    return state == State::Moveable;
}

#include <iostream>
#include <string>

#include "job.h"

Job::Job(int id, std::string machine_name)
    : job_id(id), machine(machine_name), state(State::Moveable)
{
    std::cout << "Created new job: " << id << std::endl;
}

int Job::get_id() const
{
    return job_id;
}

const std::string& Job::get_machine() const
{
    return machine;
}

bool Job::moveable() const
{
    return state == State::Moveable;
}

Change the order of variables in the constructor init list
Change the order of variables in the constructor init list

Member variables are always initialised in the order in which they were
declared in the class. If an initialiser list uses a different order,
the initialisations will be re-ordered by the compiler to match the
order of declaration. In some cases, this can lead to unexpected
behaviour when it looks like a variable is being used after
initialisation, but is in fact being used before initialisation.

This particular instance had no such issue, but it is better to keep the
constructor init list ordered to avoid any chance of this happening.
