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 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.