7.4. Interfaces

Recall that a class, as a type, is an abstraction of a real-world object from which some of the unessential details have been omitted. We can therefore see that an abstract class is more of an abstraction than a concrete class because with an abstract class we omitted the details for how one or more particular behaviors are to be performed.

Now, let's take the notion of abstractness one step further. With an abstract class, we can avoid programming the bodies of methods that are declared to be abstract. But what about the fields declared in an abstract a class? In our Course example, we went ahead and prescribed the data structure (fields) that we thought would be needed generally by all types of courses:

private string courseName; ...

Get Beginning C# 2008 Objects: From Concept to Code now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.