I am trying to write a c# program to make a Bank system with users creating bank accounts. And I want to be able to save these accounts given through the console to an excel file so it can retrieve them later if needed.
CodePudding user response:
It looks like you never set your public properties such as Fname
, either you need to set them in the constructor or make the getter get the protected field.
for example
protected string fName;
public string FName
{
get
{
return fName;
}
set
{
fName = value;
}
}
This needs to be done on all the public fields so they all get the field that gets set in the constructor.
The set is not required but if you dont use it FName
and fName
can become diffrent values since fName
is only set in the constructor.