<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: AJWAG</title>
    <description>The latest articles on DEV Community by AJWAG (@ajwag).</description>
    <link>https://dev.to/ajwag</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F861237%2F1da50538-31ae-4f2d-85d7-a978e8c68aa6.png</url>
      <title>DEV Community: AJWAG</title>
      <link>https://dev.to/ajwag</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ajwag"/>
    <language>en</language>
    <item>
      <title>A brief introduction to polymorphism for beginners</title>
      <dc:creator>AJWAG</dc:creator>
      <pubDate>Thu, 12 May 2022 05:31:25 +0000</pubDate>
      <link>https://dev.to/ajwag/a-brief-introduction-to-polymorphism-for-beginners-4nbk</link>
      <guid>https://dev.to/ajwag/a-brief-introduction-to-polymorphism-for-beginners-4nbk</guid>
      <description>&lt;p&gt;In this blog, we're going to take a look at polymorphism – what it is,  how you can use it in your code and the advantages of using polymorphism. Polymorphism can be a tricky concept to understand at first, but it's an incredibly powerful tool that can help improve the performance of your code and make development easier on large-scale projects. Let's get started!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is polymorphism&lt;/strong&gt;&lt;br&gt;
Polymorphism is a Greek word that means "many forms". In object-orientated development, objects can be of many forms, but what do we mean by this? Well, an example can be a dog, a dog can be in many different forms,it can be a poodle or a bulldog. But they are all still dogs and have certain features that are the same, for example they can all bark.&lt;/p&gt;

&lt;p&gt;Polymorphism is often used in conjunction with inheritance, but it's important to note that they are two different concepts. Inheritance allows you to create subclasses that inherit the attributes and methods of a parent class. On the other hand, polymorphism enables you to write code that can work with any object, regardless of its specific type, when the classes are related to each other by inheritance.&lt;/p&gt;

&lt;p&gt;So when we talk about polymorphism, we are talking about the relationship between a base class and its derived classes. For example, in C#, we can have a base class (which would be the dog in this example) and then we can have multiple derived classes (poodle, bulldog), which all inherit the features (methods) of the base class but polymorphism allows  the poodle and bulldog to have their own unique implementation of the features (methods). By this we mean the derived class can also override some of the features of the base class. For example, a poodle might not Bark the same as a bulldog so we can override the Bark method in the derived class to make it unique to the poodle i.e the Bark method will perform different instructions when the base class is a poodle. &lt;/p&gt;

&lt;p&gt;This is what we mean by polymorphism, an object(Dog) can be of many forms (i.e. types) like a poodle or bulldog, but still, have the same features (e.g bark). So you can write code that can work with any object, regardless of its specific type.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Polymorphism in action&lt;/strong&gt;&lt;br&gt;
Let's take a look at an example of polymorphism in action. We're going to create a base class called Dog, and then we'll create two derived classes – Poodle and Bulldog. The Dog class will have one method called Bark, and the Poodle and Bulldog classes will each have their own unique implementation of this method. Here's what our code will look like:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fENS-oEc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4u4mjighlas4cj7xdr1m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fENS-oEc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4u4mjighlas4cj7xdr1m.png" alt="Image description" width="733" height="587"&gt;&lt;/a&gt;&lt;br&gt;
This is an example of polymorphism in action – the Bark method is being "polymorphic" because it can be used in many different ways, depending on the object that it's being called on. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is upcasting?&lt;/strong&gt;&lt;br&gt;
When we talk about polymorphism, we often talk about "upcasting" and "downcasting". Upcasting is a type of polymorphism that allows us to convert a child class object into a parent class object. Upcasting is useful because it allows us to treat a child class object as if it were a parent class object, which can be handy in some situations such as when we need to pass a derived class object into a method that only accepts Base class objects&lt;br&gt;
For example, let's say we have a method that takes a Dog as a parameter:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--p-blBgHu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8q836y9qpkqfmxogqga3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--p-blBgHu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8q836y9qpkqfmxogqga3.png" alt="Image description" width="402" height="106"&gt;&lt;/a&gt;&lt;br&gt;
If we try to call this method with a Poodle, it won't work:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BJ2jKRUk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ia4n8cvvtzcw7qiwlcox.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BJ2jKRUk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ia4n8cvvtzcw7qiwlcox.png" alt="Image description" width="423" height="109"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This won't work because the DoSomething method is expecting a Dog, and we're trying to give it a Poodle. But if we upcast the Poodle to a Dog, it will work:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--y_nGfmE2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c7zms53o05yikeb8qbcf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--y_nGfmE2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c7zms53o05yikeb8qbcf.png" alt="Image description" width="406" height="121"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this example, we've upcast the poodle to a Dog, and then passed it into the DoSomething method. This works because the DoSomething method is expecting a Dog, and we're giving it a Dog but it can implement the methods in the Poodle class. &lt;br&gt;
Upcasting is safe because a Poodle is always a Dog. But downcasting is not always safe, and we'll talk about why in the next section.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is downcasting?&lt;/strong&gt;&lt;br&gt;
Downcasting is when we take a base class, and treat it as if it were a derived class. So in our example above, we could downcast a Dog to a Poodle:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--q2vxC15---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2hnmcc3r8ozyhwc6e3jh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--q2vxC15---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2hnmcc3r8ozyhwc6e3jh.png" alt="Image description" width="414" height="102"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this example, we've created a new Dog object and then downcast it to a Poodle. We can then call the Bark method on the Poodle object, and it will use the implementation in the Dog class. &lt;br&gt;
Downcasting is useful because it allows us to treat a base class as if it were a derived class. This can be helpful when we want to write code that can work with multiple types of objects. For example, let's say we have a method that takes a Poodle as a parameter:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Lf6S-tWW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/63ilgqro8va8ndzivbpk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Lf6S-tWW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/63ilgqro8va8ndzivbpk.png" alt="Image description" width="460" height="121"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If we try to call this method with a Dog, it won't work:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--x7Iqhv8Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dtq1js77o5chu5pp703e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--x7Iqhv8Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dtq1js77o5chu5pp703e.png" alt="Image description" width="330" height="80"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This won't work because the DoSomething method is expecting a Poodle, and we're trying to give it a Dog. &lt;br&gt;
But if we downcast the Dog to a Poodle, it will work:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BxjWem3H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wmt3lyf9mmy1rfee1ehg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BxjWem3H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wmt3lyf9mmy1rfee1ehg.png" alt="Image description" width="415" height="110"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this example, we've downcast the Dog to a Poodle, and then passed it into the DoSomething method. This works because the DoSomething method is expecting a Poodle, and we're giving it a Poodle.&lt;br&gt;
Downcasting is not always safe because a Dog is not always a Poodle. So if we try to downcast a Dog to a Poodle, and the Dog is not actually a Poodle, we'll get an error:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ft2Z8seW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7nenq2lvsiaipw0n6udt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ft2Z8seW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7nenq2lvsiaipw0n6udt.png" alt="Image description" width="587" height="88"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This code will throw an exception because the Dog is not actually a Poodle. &lt;br&gt;
So when should you downcast? You should only downcast when you're sure that the object is actually of the type that you're trying to downcast too. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are the advantages of polymorphism?&lt;/strong&gt;&lt;br&gt;
One benefit of using polymorphism is that it allows you to write code that is more flexible and extensible. For example, let's say you have a base class (e.g Dog) and a subclass (Poodle and Bulldog). If you later decide to add another subclass (e.g Cocker Spaniel), you can do so without having to change any of the existing code. This is because all of the subclasses will implement the same interface as the base class.&lt;br&gt;
Another benefit of using polymorphism is that it can improve the performance of your codebase. This is because you, you can easily reuse the code that you wrote for the first subclass.&lt;br&gt;
Another benefit of using polymorphism is that it makes development easier on large-scale projects. As we mentioned before, polymorphism allows you to reuse code more easily and avoid duplication. This is especially important on large-scale projects, where code duplication can lead to a lot of wasted time and effort.&lt;/p&gt;

&lt;p&gt;Polymorphism is a complex concept and can be challenging to learn but understanding it is important for any C# programmer. I am a student who is learning polymorphism as part of object-orientated programming (OOP)  and I thought it might be useful to share what I have learned so far in a blog post. I hope you find it helpful! Please feel free to leave any comments below. &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>oop</category>
      <category>csharp</category>
    </item>
    <item>
      <title>Introduction to encapsulation for beginners</title>
      <dc:creator>AJWAG</dc:creator>
      <pubDate>Thu, 12 May 2022 05:03:40 +0000</pubDate>
      <link>https://dev.to/ajwag/introduction-to-encapsulation-for-beginners-5dlg</link>
      <guid>https://dev.to/ajwag/introduction-to-encapsulation-for-beginners-5dlg</guid>
      <description>&lt;p&gt;One of the most important concepts in object-oriented programming is encapsulation. Encapsulation is a powerful tool that can help you create robust and maintainable code that protects from unwanted access. In this blog, we will cover what encapsulation is, how to create public, private, and protected members in C#,  and the advantages of using encapsulation in your codebase. &lt;/p&gt;

&lt;h2&gt;
  
  
  What is encapsulation?
&lt;/h2&gt;

&lt;p&gt;Encapsulation is a fundamental principle of object-oriented programming. It's a way of bundling data and protecting that data in an object from being accessed or modified by outside code. Encapsulation is achieved by grouping similar data and methods into one place, i.e. "encapsulating" them in a class and controlling access by using access modifiers with public, private, and protected keywords. By encapsulating data and methods into a class, you can control how other classes interact with a class. This can prevent other classes from accidentally modifying code, and it can also make it easier to change the implementation later on without affecting the rest of the codebase. &lt;br&gt;
Encapsulation is often confused with abstraction. Abstraction is about hiding the implementation details of a class from other classes. Encapsulation is about bundling similar data and methods and hiding the data in an object from being accessed or modified by code outside the object. &lt;br&gt;
&lt;strong&gt;Implementing encapsulation in C#&lt;/strong&gt;&lt;br&gt;
Let's look at how to create public, private, and protected members in C#.&lt;br&gt;
• Public members are accessible from anywhere outside the class. &lt;br&gt;
• Private members are only accessible from within the class. &lt;br&gt;
• Protected members are accessible from within the class and from derived classes.&lt;br&gt;
*&lt;em&gt;Get and Set Methods *&lt;/em&gt;&lt;br&gt;
As we mentioned above, one way to achieve encapsulation is by using public methods to get and set the values of private variables. These methods are often called "getters" and "setters". &lt;br&gt;
Let's look at an example. We have a class with two private variables: _name and _age. We've provided public methods to get and set the values of these variables. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qPDlrBeW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2om5h7cgvyhc3pep3wmx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qPDlrBeW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2om5h7cgvyhc3pep3wmx.png" alt="Image description" width="596" height="537"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You might be wondering why we need set and get methods at all. Can't we just make the variables public? The answer is no. If we made the variables public, anyone could access and modify them from outside the class, violating the principle of encapsulation. &lt;br&gt;
Notice that the setters have a void return type and take one parameter of the same type as the variable being set. The getters have a return type of the same type as the variable being returned and don't take any parameters. This is a common pattern, but it's not required. You can name your methods whatever you want and have them return whatever type you want. The only requirement is that the setter method must take one parameter, and the getter method must not take any parameters. &lt;br&gt;
*&lt;em&gt;Properties *&lt;/em&gt;&lt;br&gt;
A shortcut way of get and set in C# is using properties. &lt;br&gt;
A property is a public member of a class that encapsulates a private field. A property has a getter and setter method to access the field. The getter method returns the value of the field, and the setter method sets the value of the field. &lt;br&gt;
You can create a property by using the following syntax: &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bCKuzf1G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vjd3vz6c67tx0vsd5v2c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bCKuzf1G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vjd3vz6c67tx0vsd5v2c.png" alt="Image description" width="392" height="63"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The advantages of encapsulation&lt;/strong&gt;&lt;br&gt;
Data security: A significant advantage of encapsulation is that is provides a way to protect the data in an object from being accessed or modified by code outside the object. This is helpful because it keeps the data safe from accidentally corrupted by other code or users. &lt;br&gt;
Code is easier to maintain: When a class is encapsulated, it is easier to see what it does and how it works. All the data and methods are in one place, so it is easy to find them when you need to make changes. &lt;br&gt;
Encapsulation also makes code easier to read and understand:  you can see at a glance what data the class is working with and what methods are available to manipulate that data. This can make your codebase more maintainable in the long run.&lt;br&gt;
other classes need to be able to access, you would make it public. Similarly, if you have a method that other classes need to be able to call, you would make it public.&lt;/p&gt;

&lt;p&gt;Encapsulation is a powerful tool that can help you to protect your data and make your code easier to maintain. It's not something you should use all the time, but it can be very useful in certain situations. I hope this article has been helpful and given you a better understanding of what encapsulation is and how to use it in your own projects. I am a student learning object-orientated programming (OOP) so if you have any comments or suggestions, please feel free to leave them below. Thanks for reading! &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>oop</category>
      <category>csharp</category>
    </item>
    <item>
      <title>Introduction to abstraction for beginners</title>
      <dc:creator>AJWAG</dc:creator>
      <pubDate>Thu, 12 May 2022 03:17:39 +0000</pubDate>
      <link>https://dev.to/ajwag/introduction-to-abstraction-for-beginners-4c6n</link>
      <guid>https://dev.to/ajwag/introduction-to-abstraction-for-beginners-4c6n</guid>
      <description>&lt;p&gt;In object-oriented programming, abstraction is a critical concept that allows you to create classes and methods that represent the general concept of an object rather than specific instances of that object. The purpose of this is to hide implementation details from users. This blog will explain what abstraction is, how it is implemented in C# and the advantages of abstraction. &lt;/p&gt;

&lt;h2&gt;
  
  
  *&lt;em&gt;What is abstraction in object-orientated programming? *&lt;/em&gt;
&lt;/h2&gt;

&lt;p&gt;Abstraction in object-orientated programming hides unimportant and complex details from the user and only displays the vital information. This means a user doesn't need to understand the complexities of a program in order to use it. When you drive a car, you don't need to know how the engine works to get from point A to point B. You can get in the car and turn the key, and the engine will take care of the rest. This is an example of abstraction in the real world. &lt;/p&gt;

&lt;p&gt;Abstraction is often confused with encapsulation. However, encapsulation and abstraction are two different concepts. Encapsulation is another key concept in object-oriented programming that refers to bundling data with the methods that operate on that data and involves restricting access to the data and methods, which is sometimes referred to as data hiding. Abstraction is a way of hiding the implementation details of an object from the user, whereas encapsulation is a way of hiding the data itself from the user. &lt;br&gt;
&lt;strong&gt;How do abstract classes provide abstraction?&lt;/strong&gt;&lt;br&gt;
An abstract class is a class that cannot be instantiated, which means that you cannot create an object of the abstract class type. An abstract class can, however, be inherited by another class. When an abstract class is inherited, the inheriting class must provide implementations for all of the abstract members of the base class. The result is that the base class hides the implementation details of those members from the inheriting class by effectively adding a layer ( the abstract class) of abstraction. &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;How to implement abstraction in C#&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;As mentioned previously, abstraction is implemented in classes and methods. In C#, you can create an abstract class using the keyword "abstract" and it can contain abstract and non-abstract members. An abstract class is a class that cannot be instantiated, meaning you cannot create an object of that type. Abstract methods do not have a body, and they must be implemented in a derived class. The non-abstract methods are methods that have a body, and they can be called without having to implement them in a derived class. In the following example, we have created an abstract class called "Animal" with one abstract method and one non-abstract method:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nIuvByfH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kh5g7q32osvr3bw5hdyh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nIuvByfH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kh5g7q32osvr3bw5hdyh.png" alt="Image description" width="399" height="234"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, the "Animal" class has an abstract method called "MakeNoise" and a non-abstract method called "Sleep". The "MakeNoise" method does not have a body, so it must be implemented in a derived class. The "Sleep" method has a body, so it can be called without having to implement it in a derived class.&lt;br&gt;
You cannot create an abstract method in a non-abstract class. In the following example, we have attempted to create an abstract method called "MakeNoise" in the "Animal" class:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EBsRp_2v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t1ydo8qheffunt3oowqa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EBsRp_2v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t1ydo8qheffunt3oowqa.png" alt="Image description" width="362" height="234"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, the "Animal" class is showing  the abstract method called "MakeNoise" with an error.&lt;/p&gt;

&lt;p&gt;When you create an abstract method, you must provide a body for the method in a derived class. You can do this by using the keyword "override ". In the following example, we have created a derived class called "Dog" that overrides the "MakeNoise" method:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VpqWtWpk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oidq404ihwx5i7km89ot.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VpqWtWpk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oidq404ihwx5i7km89ot.png" alt="Image description" width="353" height="208"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, the "Dog" class overrides the "MakeNoise" method by providing a body for the method. When you call the "MakeNoise" method on an object of type "Dog", the "Woof!" message will be displayed.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are the advantages of abstraction?
&lt;/h2&gt;

&lt;p&gt;There are several benefits of abstraction in software development:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Abstraction allows you to create reusable code.&lt;/li&gt;
&lt;li&gt;Abstraction makes your code more efficient and easier to maintain.&lt;/li&gt;
&lt;li&gt;Abstraction can make your code more flexible and extensible.&lt;/li&gt;
&lt;li&gt;Abstraction can help you prevent code duplication.&lt;/li&gt;
&lt;li&gt;Abstraction can make your code more understandable and easier to use.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There you have it, an introduction to abstraction! I am writing this blog as a student in Object-Oriented development and I hope you find it helpful! If you have any questions, please feel free to leave a comment below. Thanks for reading!&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>oop</category>
      <category>csharp</category>
    </item>
  </channel>
</rss>
