2.1. Our First Independent Class

A class may represent an independent abstraction, or it may represent a specialization of a more general abstraction. For example, FileStream and MemoryStream are both specialized class definitions of the System.IO namespace Stream class. A stream represents a general flow of data either into or out of our program. It is an abstract class because although it defines the behavior of a stream (the public interface); it does not provide a complete implementation. The completion of the stream implementation is left to the more specialized file and memory stream classes, which define the input/output medium. Both the file and the memory stream classes are called subtypes of the stream class type. This type/subtype ...

Get C# Primer: A Practical Approach now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.