Abstraction in OOPs

Abstraction means to show essential details to the client.

Do you know the inner details of the Monitor of your PC? What happen when you switch ON Monitor? Does this matter to you what is happening inside the Monitor? No Right, Important thing for you is weather Monitor is ON or NOT. When you change the gear of your vehicle are you really concern about the inner details of your vehicle engine? No but what matter to you is that Gear must get changed that’s it!! This is abstraction; show only the details which matter to the user.

Encapsulation the mechanism by which Abstraction is implemented.

Example1: I have class Animal and I am making a sub class of the class Animal called Tiger.
Then I will say that its color is yellow and running is very fast.
Also I can make the class Hippo but it’s color is black and running is very slow.
This is an example of Abstraction.

Example2: Abstraction , we have a class car and we’ve declared it as abstract, there another class called Audi that inherits car class and implement its method with its own functionalities, there are one more class called BMW, and it also inherits car class and implements its method with its own functionality. Both classes BMW & Audi implemented the same method with different functionalities, this is called abstraction.

Interfaces are again a form of absstraction , Getter/Setter (properties) are abstraction , Delegates are abstraction  , Lambda and LINQ are abstraction.

public abstract class Car{
    public abstract void StartCar();
}
 public class Audi : Car{
    #region Overrides of Car
     public override void StartCar(){
        UseCarKey();
    } 
    #endregion
} 
public class BMW : Car{
    #region Overrides of Car 
    public override void StartCar()    {
        UseCarChipcard();
    } 
    #endregion
}
Advertisements

22 thoughts on “Abstraction in OOPs

  1. After looking over a number of the blog articles on
    your blog, I seriously appreciate your technique of
    blogging. I bookmarked it to my bookmark website list and will be
    checking back soon. Please visit my website as well and let me
    know your opinion.

    Like

  2. I like the valuable info you provide in your articles. I will bookmark
    your blog and check again here frequently. I am quite certain I’ll learn lots of new stuff right here! Best of luck for the next!

    Like

  3. Does your website have a contact page? I’m having trouble locating it but, I’d like to shoot you an email.
    I’ve got some ideas for your blog you might be interested in hearing. Either way, great website and I look forward to seeing it expand over time.

    Like

  4. Thanks alot 🙂 on your marvelous article! I actually liked reading it,
    you will be a great author. I will make certain to bookmark your webpage and may return later on.
    I have to motivate you to ultimately keep on your outstanding work,
    have a wonderful evening!

    Like

  5. Hello. I’m sorry to bother you but I happened to run across your site and discovered you are using the exact same template as me. The only issue is on my website, I’m struggling
    to get the design and style looking like yours. Would you mind e-mailing
    me at: lenorapeters@zoho.com so I can get this figured out.
    By the way I’ve bookmarked your website: https://codeworldtechnology.wordpress.com/2013/05/16/abstraction-in-oops/ and will be visiting frequently. Thanks alot :)!

    Like

  6. I have loaded your blog in 4 different web browsers and I must say this blog loads a lot quicker
    then most. Would you mind emailing me the name of your website hosting company?
    My personal e-mail is: verleneburks@yahoo.
    com. I’ll even sign up through your own affiliate link if you would like. Appreciate it

    Like

  7. Hi there just wanted to give you a quick heads up.
    The words in your article seem to be running off the screen in Chrome.
    I’m not sure if this is a formatting issue or something to do with web browser compatibility but I thought I’d post to let you know.
    The design look great though! Hope you get
    the problem fixed soon. Cheers

    Like

  8. Howdy! This is my first comment here so I just wanted to give a
    quick shout out and say I genuinely enjoy reading through your posts.
    Can you recommend any other blogs/websites/forums that deal with the same subjects?

    Thanks!

    Like

  9. Hi I am so happy I found your weblog, I really found
    you by error, while I was looking on DuckDuckGo for something else,
    Anyhow I am here now and would just like to say many thanks for
    a remarkable post and a all round enjoyable blog (I also love the theme/design),
    I don’t have time to read through it all at the moment but I have saved
    it and also added in your RSS feeds, so when I have time I will be back to read more, Please do
    keep up the superb work.

    Like

  10. Write more, thats all I have to say. Literally, it seems as
    though you relied on the video to make your point. You definitely
    know what youre talking about, why throw away your intelligence on just posting videos to your site when you could
    be giving us something enlightening to read?

    Like

  11. Good day! I could have sworn I’ve been to this blog before but after reading through some of the post I realized it’s new to me.
    Anyways, I’m definitely delighted I found it and I’ll be bookmarking
    and checking back frequently!

    Like

  12. Everyone loves what you guys tend to be up too. This sort
    of clever work and reporting! Keep up the amazing works guys I’ve you guys to our blogroll.

    Like

  13. I’ve been exploring for a little bit for any high-quality articles or blog posts on this sort of area . Exploring in Yahoo I at last stumbled upon this web site. Reading this information So i am happy to convey that I have a very good uncanny feeling I discovered just what I needed. I most certainly will make certain to do not forget this website and give it a look on a constant basis.

    Like

  14. Woah! I’m really digging the template/theme of this blog. It’s simple, yet effective.
    A lot of times it’s challenging to get that “perfect balance” between user friendliness and visual appearance. I must say you’ve done a excellent job with this.
    Additionally, the blog loads extremely quick
    for me on Opera. Superb Blog!

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s