Finished Defining an Abstract Class
parent
fe71127f3a
commit
55ce261ed8
|
@ -19,7 +19,15 @@ namespace GradeBook
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class Book : NamedObject
|
public interface IBook
|
||||||
|
{
|
||||||
|
void AddGrade(double grade);
|
||||||
|
Statistics GetStatistics();
|
||||||
|
string Name { get; }
|
||||||
|
event GradeAddedDelegate GradeAdded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract class Book : NamedObject, IBook
|
||||||
{
|
{
|
||||||
// Abstract class used to act as entrypoint for other class, so output
|
// Abstract class used to act as entrypoint for other class, so output
|
||||||
// can change based on given input. At this level, we cannot provide implementation
|
// can change based on given input. At this level, we cannot provide implementation
|
||||||
|
@ -30,8 +38,14 @@ namespace GradeBook
|
||||||
|
|
||||||
}
|
}
|
||||||
public abstract void AddGrade(double grade);
|
public abstract void AddGrade(double grade);
|
||||||
|
|
||||||
|
public virtual event GradeAddedDelegate GradeAdded;
|
||||||
|
public virtual Statistics GetStatistics()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public class InMemoryBook : Book
|
public class InMemoryBook : Book, IBook
|
||||||
{
|
{
|
||||||
private List<double> grades;
|
private List<double> grades;
|
||||||
|
|
||||||
|
@ -81,9 +95,9 @@ namespace GradeBook
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public event GradeAddedDelegate GradeAdded;
|
public override event GradeAddedDelegate GradeAdded;
|
||||||
|
|
||||||
public Statistics GetStatistics()
|
public override Statistics GetStatistics()
|
||||||
{
|
{
|
||||||
var result = new Statistics();
|
var result = new Statistics();
|
||||||
result.Average = 0.0;
|
result.Average = 0.0;
|
||||||
|
|
Loading…
Reference in New Issue