Finished Using IDisposable

This commit is contained in:
Jason Zhu 2021-02-23 00:02:47 +00:00
parent 55ce261ed8
commit 0435f6592e

View File

@ -1,4 +1,5 @@
using System;
using System.IO;
using System.Collections.Generic;
namespace GradeBook
@ -39,8 +40,31 @@ namespace GradeBook
}
public abstract void AddGrade(double grade);
public virtual event GradeAddedDelegate GradeAdded;
public virtual Statistics GetStatistics()
public abstract event GradeAddedDelegate GradeAdded;
public abstract Statistics GetStatistics();
}
public class DiskBook : Book
{
public DiskBook(string name) : base(name)
{
}
public override event GradeAddedDelegate GradeAdded;
public override void AddGrade(double grade)
{
using(var writer = File.AppendText($"{Name}.txt"))
{
writer.WriteLine("Test");
if (GradeAdded != null)
{
GradeAdded(this, new EventArgs());
}
}
}
public override Statistics GetStatistics()
{
throw new NotImplementedException();
}