Hi friends. In this article, we will be discussing about what is Abstraction in Object Oriented Programming. Also, we will see a relevant video lecture.
What is Abstraction?
Abstraction, is a well-known technique in Object Oriented Programming and generally in Computer Science.
It is a way, of handling a complex problem, by removing the background details. This will allow you to focus on the problem’s core, that is the main concept and thus, easily understand how you can resolve the problem via a program that you can author.
Main Benefits of Abstraction
The main benefits of Abstraction in Computer Programming are:
- It helps reducing complexity in solving problems
- It contributes to more efficient software design
- It helps avoiding code duplication
- It makes it easier to maintain the program
Example of Abstraction in C#
The below C# source code, illustrates a simple example of implementing abstraction in C#.
As you can see, the code below, contains an abstract class named “Vehicle“, which has an abstract method that returns an integer and it is named “height()“. This is the abstraction part of the example; that is an abstract class with an abstract method.
Now, when we want to create a class that derives its characteristics from an abstract class, we create the class along with stating (using the colon (“:”) punctuation mark) that the class is an implementation based on an abstract class and within the body of the class, we override any methods that were originally specified in the abstract class.
To this end, in the below example, after we create the abstract class “Vehicle”, we create the class “Car” which is an implementation of the abstract class. That’s why we define the “Car” class using this code: class Car : Vehicle
Please check the code below, for the full example:
Watch a Video Lecture on Abstraction
Below, you can find a video lecture on Abstraction, taken from our course on Udemy, titled “Introduction to Computer Programming for Beginners 2022“. You can enroll to the course, using the link below, which automatically provides a significant discount.
Learn Programming From Scratch – Enroll to our Online Course!
Check our online course “Introduction to Computer Programming for Beginners”
Throughout the course, you will learn everything you need to get started with Computer Programming!
Featured Online Courses:
- Working with Python on Windows and SQL Server Databases
- Introduction to Azure Database for MySQL
- Boost SQL Server Database Performance with In-Memory OLTP
- Introduction to Azure SQL Database for Beginners
- Essential SQL Server Administration Tips
- SQL Server Fundamentals – SQL Database for Beginners
- Essential SQL Server Development Tips for SQL Developers
- Introduction to Computer Programming for Beginners
- .NET Programming for Beginners – Windows Forms with C#
- Introduction to SQL Server Machine Learning Services
- SQL Server 2019: What’s New – New and Enhanced Features
- Entity Framework: Getting Started – Complete Beginners Guide
- How to Import and Export Data in SQL Server Databases
- Learn How to Install and Start Using SQL Server in 30 Mins
- A Guide on How to Start and Monetize a Successful Blog
- Data Management for Beginners – Main Principles
Read Also:
- How to Connect to SQL Server Databases from a Python Program
- Useful Python Programming Tips
- Main Data Structures in Python
- IndentationError: expected an indented block in Python – How to Resolve it
- Working with Python on Windows and SQL Server Databases (Course Preview)
- How to Write to a Text File from a C++ Program
- How to Establish a Simple Connection from a C# Program to SQL Server
- The timeout period elapsed prior to obtaining a connection from the pool
- Closing a C# Application (including hidden forms)
- Changing the startup form in a C# project
- Using the C# SqlParameter Object for Writing More Secure Code
- Cannot implicitly convert type ‘string’ to ‘System.Windows.Forms.DataGridViewTextBoxColumn
- Missing parentheses in call to ‘print’. did you mean print(…) – How to Resolve in Python
Subscribe to our newsletter and stay up to date!
Subscribe to our YouTube channel (SQLNetHub TV)
Easily generate snippets with Snippets Generator!
Secure your databases using DBA Security Advisor!
Generate dynamic T-SQL scripts with Dynamic SQL Generator!
Check our latest software releases!
Check our eBooks!
Rate this article:
Reference: SQLNetHub.com (https://www.sqlnethub.com)
© SQLNetHub
Artemakis Artemiou is a seasoned Senior Database and AI/Automation Architect with over 20 years of expertise in the IT industry. As a Certified Database, Cloud, and AI professional, he has been recognized as a thought leader, earning the prestigious Microsoft Data Platform MVP title for nine consecutive years (2009-2018). Driven by a passion for simplifying complex topics, Artemakis shares his expertise through articles, online courses, and speaking engagements. He empowers professionals around the globe to excel in Databases, Cloud, AI, Automation, and Software Development. Committed to innovation and education, Artemakis strives to make technology accessible and impactful for everyone.