- C# -Program Structure
- Data types
- Operator types
- class and object (Access Modifier types)
- Single Inhertiance
- Hierarchical Inheritance
- Compile and rum time Polymorphism
- function overloading
- operator overloading
- Method overloading
- dynamic polymorphsym
- Abstract class and polymorphism
- DivideByZero Exception
- ArrayTypeMismtach
- IndexOutOfBoundException
- fileIOException
- StringArgumentException
What you'll learn
- types of polymorphism
- the exception types
- polymorphysm fundamentals
- exception and errors
Description
Polymorphism in C#
Polymorphism is a Greek word, meaning "one name many forms". In other words, one object has many forms or has one name with multiple functionalities. "Poly" means many and "morph" means forms. Polymorphism provides the ability to a class to have multiple implementations with the same name. It is one of the core principles of Object Oriented Programming after encapsulation and inheritance. In this article, you'll learn what polymorphism is, how it works, and how to implement polymorphism in C#.
Types of Polymorphism
There are two types of polymorphism in C#:
Static / Compile Time Polymorphism.
Dynamic / Runtime Polymorphism.
Static or Compile Time Polymorphism
It is also known as Early Binding. Method overloading is an example of Static Polymorphism. In overloading, the method / function has a same name but different signatures. It is also known as Compile Time Polymorphism because the decision of which method is to be called is made at compile time. Overloading is the concept in which method names are the same with a different set of parameters.
Here C# compiler checks the number of parameters passed and the type of parameter and make the decision of which method to call and it throw an error if no matching method is found.Dynamic / runtime polymorphism is also known as late binding. Here, the method name and the method signature (number of parameters and parameter type must be the same and may have a different implementation). Method overriding is an example of dynamic polymorphism.
Method overriding can be done using inheritance. With method overriding it is possible for the base class and derived class to have the same method name and same something. The compiler would not be aware of the method available for overriding the functionality, so the compiler does not throw an error at compile time. The compiler will decide which method to call at runtime and if no method is found then it throws an error.
An exception is a problem that arises during the execution of a program. A C# exception is a response to an exceptional circumstance that arises while a program is running, such as an attempt to divide by zero.
Exceptions provide a way to transfer control from one part of a program to another. C# exception handling is built upon four keywords: try, catch, finally, and throw.
try − A try block identifies a block of code for which particular exceptions is activated. It is followed by one or more catch blocks.
catch − A program catches an exception with an exception handler at the place in a program where you want to handle the problem. The catch keyword indicates the catching of an exception.
finally − The finally block is used to execute a given set of statements, whether an exception is thrown or not thrown. For example, if you open a file, it must be closed whether an exception is raised or not.
throw − A program throws an exception when a problem shows up. This is done using a throw keyword.
Other Courses
Basic Email Marketing For Beginners
Learn the basic skills to get started email marketing in a few easy steps.
Video Strategies for Sales Success
Leveraging Video in Today's Market | Building Trust and Shortening Sales Cycles
Introduction to Internet of Things and Cloud
Learn the basics of the IoT and Cloud Systems
How to set and measure KPIs for your social media marketing
Analysis of the most common and some not so common key performance indicators (KPIs), their purpose and how to measure
About the instructors
- 3.93 Calificación
- 9345 Estudiantes
- 12 Cursos
Suprio Dutta
Btech CUSAT
IT Professional with 8+ Experience in software training and more than 10+ years at undergraduate and graduate level mathematics.
Mentoring Dotnet framework and its interrelated Corporate level Education .,MICROSOFT Visual studio DotNet,Microsoft sql server, my sql oracle server,objected oriented programing langauge like c++ and Java..and Azure.
knowledge offered is with Advanced topics in the desktop applications and consumed projects are mainly comprising of Enterprise based applications,client relationship management and E-Commerce.
offered training for Bank exams for more than 2+ years at Brillinace college ,Trivandrum,Kerala for candidates appearing for various Bank exmas and various other competitive exmas for subjects reasoning,numericals, Gk and English..
Student feedback
Course Rating
Reviews
bad
this guy is waffling about basic stuff for way too long.
Very unclear english didnt understand a word of the instructor
n/a
Excellent
audio is not clear