Data abstraction is a resource based on the most important characteristics of the user. No unnecessary detail is shown to the user.
In C# we can achieve the abstraction with the help of abstract class
abstract class Shape_Class
{
public abstract int Total_area();
}
class Square_Class : Shape_Class
{
private int side_length;
public Square_Class(int x = 0)
{
side_length = x;
}
public override int Total_area()
{
Console.Write("Total area of Square Class: ");
return (side_length * side_length);
}
}
class EntryPoint
{
static void Main(string[] args)
{
Shape_Class sh = new Square_Class(10);
double result = sh.Total_area();
Console.Write(result);
}
}
Total area of Square Class: 100
The word abstract known as a concept or an idea not associated with any specific instance. In programming, we apply the same meaning of abstraction by making classes not associated with any specific instance
In C# abstraction is achieved by the abstract classes and interface
A method called an abstract method that has no "body" and is only described in the summary class.