Book Image

Learn C# in 7 days

By : Gaurav Aroraa
1 (1)
Book Image

Learn C# in 7 days

1 (1)
By: Gaurav Aroraa

Overview of this book

This book takes a unique approach to teach C# to absolute beginners. You’ll learn the basics of the language in seven days. It takes a practical approach to explain the important concepts that build the foundation of the C# programming language. The book begins by teaching you the basic fundamentals using real-world practical examples and gets you acquainted with C# programming. We cover some important features and nuances of the language in a hands-on way, helping you grasp the concepts in a fluid manner. Later, you’ll explore the concepts of Object-Oriented Programming (OOP) through a real-world example. Then we dive into advanced-level concepts such as generics and collections, and you’ll get acquainted with objects and LINQ. Towards the end, you’ll build an application that covers all the concepts explained in the book. By the end of this book, you will have next-level skills and a good knowledge of the fundamentals of C#.
Table of Contents (15 chapters)
Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Polymorphism


In simple words, polymorphism means having many forms. In C#, we can express one interface with multiple functions as polymorphism. Polymorphism is taken from Greek-word that has meaning of many-shapes.

Note

All types in C# (including user-defined types) inherit from object hence every type in C# is polymorphic.

As we discussed polymorphism means many forms. These forms can be of functions where we implement function of same name having same parameters in different forms in derived classes. Also, polymorphism is having the capability to provide different implementation of methods that are implemented with same name.

In coming sections, we will discuss the various types of polymorphism including their implementation using C# 7.0.

Types of polymorphism

In C#, we have two types of polymorphism and these types are:

  • Compile-time polymorphism

Compile-time polymorphism is also famous as early binding or overloading or static binding. It determines at compile-time and meant for same function...