Abstraction:
Abstraction is "To represent the essential feature without representing the back ground details."
Abstraction provides you a generalized view of your classes or object by providing relevant information.
Suppose you have 3 mobile phones as following:-
Nokia 2700 (Features:- Calling, SMS, FM Radio, MP3, Camera)
Sony Ericsson (Features:-Calling, SMS, FM Radio, MP3, Camera, Video Recording, Reading E-mails)
Abstract information (Necessary and Common Information) for the object "Mobile Phone" is make a call to any number and can send SMS."
abstract class MobilePhone
{
public void Calling();
public void SendSMS();
}
public class Nokia1400 : MobilePhone
{
}
public class Nokia2700 : MobilePhone
{
public void FMRadio();
public void MP3();
public void Camera();
}
public class Sony Ericsson : MobilePhone
{
public void FMRadio();
public void MP3();
public void Camera();
public void Recording();
public void ReadAndSendEmails();
}
Abstraction means putting all the variables and methods in a class which are necessary.
For example: - Abstract class and abstract method.
Abstraction is the common thing.
example:
If somebody in your collage tell you to fill application form, you will fill your details like name, address, data of birth, which semester, percentage you have got etc.
If some doctor gives you an application to fill the details, you will fill the details like name, address, date of birth, blood group, height and weight.
See in the above example what is the common thing?
Age, name, address so you can create the class which consist of common thing that is called abstract class.
That class is not complete and it can inherit by other class.