Complete the code to define a constructor for the class.
public class Person { public string Name; [1] Person(string name) { Name = name; } }
The constructor must have the public access modifier to be accessible and properly defined.
Complete the constructor to initialize the Age field.
public class Person { public int Age; public Person(int age) { [1] = age; } }
Use this.Age to refer to the instance field and assign the parameter value.
Fix the error in the constructor to properly initialize the field.
public class Car { public string Model; public Car(string model) { Model = [1]; } }
The parameter model should be assigned to the field Model.
Fill both blanks to create a constructor that initializes both fields.
public class Book { public string Title; public int Pages; public Book([1] title, [2] pages) { Title = title; Pages = pages; } }
Constructor parameters need types and the constructor should be public.
Fill all three blanks to create a constructor that initializes fields with different names.
public class Student { public string Name; public int Grade; [1] Student([2] studentName, int studentGrade) { Name = [3]; Grade = studentGrade; } }
The constructor is public, parameters need types, and the field Name is assigned the parameter studentName.
