OOPS - Object Oriented Programming FAQ
Four main principles of OOPS
1. Encapsulation
2. Inheritance
3. Polymorphism
4. Abstraction
1. Encapsulation
- Encapsulation is the process of hiding the irrelevant information and showing only relevant information to the user.
- Encapsulation is the process of wrapping up of data and member in a class.
Example:
- Only specific method or properties can access the private member of class.
- Data Hiding through the private class access specifier.
Uses:
-Increase the maintainability of the code by showing only relevant information to the User.
2. Abstraction
- Abstraction is the process of hiding the details and exposing only the essential feature of particular concept or object.
Real time example:
Refrigerator:
The process of showing the general information related to the refrigerator is called Abstraction and hiding the complex information from the user is Encapsulation.
3.Inheritance
- Inheritance is the process through which a child class obtain the feature defined its parent class.
- Used for reuse of code and eliminate redundant code.
Types:
- Single, Multilevel, Multiple and Hierarchical.
4.Polymorphism
- One Interface multiple methods
- With the help of Polymorphism we can use one procedure in many ways based on our requirement.
Method Overloading:
-Method according to number and types of parameter.
Operator Overloading:
-Change the functionality of operator.
Runtime Polymorphism
Overriding
-Overriding is the feature that allows derived class to provide a specific implementation of a method that is already provided its base class.
Dotnet, DotnetCore, Azure, C#,VB.net, Sql Server, WCF, MVC ,Linq, Javascript and Jquery
Subscribe to:
Post Comments (Atom)
Implementing OAuth validation in a Web API
I mplementing OAuth validation in a Web API Implementing OAuth validation in a Web API using C# typically involves several key steps to sec...
-
ViewBag, ViewData, TempData and View State in MVC ASP.NET MVC offers us three options ViewData, ViewBag and TempData for passing data from...
-
// Export Datatable to Excel in C# Windows application using System; using System.Data; using System.IO; using System.Windows.Forms; ...
No comments:
Post a Comment
Comments Welcome