so, i created this piece of code which is supposed to represent a person/student at a school.
my goal behind this code is to allow me to create a new student without having to manually make a new inherited class for every new student i want to add to my system. The problem is that i dont have the slightest idea of where to begin. Can anybody give me a lead that can help me?
class student
{
//alle properties van de student
public string studentnummer;
public string naam;
public string postcode;
public string telefoonnummer;
public List<string> vakken;
//een no-argument constructor
public student()
{
//informatie over de studen
studentnummer = "S101010";
naam = "Voornaam Achternaam";
postcode = "1111AT";
telefoonnummer = "31+ 0571 123456";
vakken = new List<string>();
vakken.Add("Voorbeeld vak 1");
vakken.Add("Voorbeeld vak 2");
}
//override van de ToString methode? (ik weet niet of dit ook de goede manier is)
public override string ToString()
{
return $"Studentnummer: {studentnummer}, naam: {naam}, postcode: {postcode}, telefoonnummer :{telefoonnummer}, aantal vakken: {String.Join(", ", vakken)}";
}
}
class Program
{
static void Main(string[] args)
{
student Student = new student();
Console.WriteLine(Student.ToString());
Console.WriteLine(" ");
Console.WriteLine(" ");
}
}
I am still in the early stages of learning to code and dont know of any way my goal can be archieved.
EDIT: not only do i have no clue where to begin, I also dont even know how to do it.