Review this generated Course class against the requested contract.
Implement a course that starts empty, requires a positive capacity, refuses enrollment when full, and exposes read-only student access.
C++
#include <cstddef>
#include <string>
#include <utility>
#include <vector>
class Course {
public:
Course(std::string name, std::size_t capacity)
: enrolled_(capacity), capacity_(capacity), name_(std::move(name)) {}
void enroll(std::string student) {
students_.push_back(std::move(student));
++enrolled_;
}
std::vector<std::string> students() const { return students_; }
std::size_t remaining() const { return capacity_ - enrolled_; }
private:
std::size_t enrolled_;
std::size_t capacity_;
std::string name_;
std::vector<std::string> students_;
};
generated code is illustrative, not from any one model