Finished Deriving from a Base Class
parent
2b07530bb3
commit
f7ef36beab
|
@ -5,20 +5,28 @@ namespace GradeBook
|
|||
{
|
||||
public delegate void GradeAddedDelegate(object sender, EventArgs args);
|
||||
|
||||
public class Book
|
||||
public class NamedObject
|
||||
{
|
||||
|
||||
public NamedObject(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
public string Name
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
public class Book : NamedObject
|
||||
{
|
||||
private List<double> grades;
|
||||
|
||||
readonly string category;
|
||||
|
||||
private string name;
|
||||
public string Name
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Book(string name)
|
||||
public Book(string name) : base(name)
|
||||
{
|
||||
Name = name;
|
||||
grades = new List<double>();
|
||||
|
|
|
@ -8,16 +8,8 @@ namespace GradeBook
|
|||
static void Main(string[] args)
|
||||
{
|
||||
|
||||
// var book = new Book("Scott's Grade Book");
|
||||
// book.AddGrade(89.1);
|
||||
// book.AddGrade(90.5);
|
||||
// book.AddGrade(87.2);
|
||||
|
||||
var book = new Book("Jason's Grade Book");
|
||||
book.GradeAdded += OnGradeAdded;
|
||||
book.GradeAdded += OnGradeAdded;
|
||||
book.GradeAdded -= OnGradeAdded;
|
||||
book.GradeAdded -= OnGradeAdded;
|
||||
|
||||
string input;
|
||||
|
||||
|
|
Loading…
Reference in New Issue