I have a Student class in my console application like this :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
public class Student
{
public Student(Student student)
{
StudentId = student.StudentId;
FullName = student.FullName;
}
public int StudentId { get; set; }
public string FullName { get; set; }
}
}
It has a copy constructor in its body and when I want to instantiate it in the Program class like this:
Student student = new Student();
I will have an error that
"There is no argument given that corresponds to the required formal parameter 'student' of 'Student.Student(Student)'"
When I can not instantiate my Student class how could I pass the argument of Student to its constructor ?
I want to instantiate my Student class but I've got the error on it that I described.
new Student()cannot work. What do you expect theStudentfields to hold in this case ?