Polymorphism, as implemented through an abstract base class, is also prohibited when you are using a structure, since a structure cannot inherit from another class with the exception of boxing to Object, ValueType, or Enum. This limitation precludes creating structure hierarchies, as you can do with classes. Like classes, structures can implement interfaces, but unlike classes, they cannot inherit from a class or a structure. Classes are much more flexible than structures. This chapter also contains a recipe on parsing command-line parameters, which is always a favorite.īefore diving into the recipes, let’s review some key information about the object-oriented capabilities of classes, structures, and generics. In addition, we will dive into topics such as union types, field initialization, lambdas, partial methods, single and multicast delegates, closures, functors, and more. Building on this, we will construct classes that have inherent functionality such as being sortable, searchable, disposable, and cloneable. Topics include classes and structures, how they are used, how they are different, and when you would use one over the other. The recipes in this chapter cover the foundation of the C# language.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |