Initialization List

You are given an integer a.

Create a class Student with the following field:

  • age (integer)

Use a constructor initialization list to initialize age with the value a.

Create an object of class Student and return the object.

Note:

  • The class name must be exactly Student
  • The field name must be exactly age and it should be public

Example 1:

Input: a = 5

Output: 5

Example 2:

Input: a = 15

Output: 15

Still unsure what the problem is asking ?

Let’s go through a few more examples, step by step, to make it clearer.

Constraints:

  • 1 <= a <= 100
0
class Solution {
public:
Student createStudent(int a) {
//your code goes here
}
};
Test Case

Input:

A