Mahesh Alle
Give me the real time example of abstraction in c#.
By Mahesh Alle in OOP/OOD on Mar 24 2014
  • Palle Technologies
    Apr, 2014 2

    Have you tried calling Response.Write method or Console.Write or WriteLine method any time from your code ( most probably yes ) . Now the next question is have you ever observed the code written by microsoft engineers in the respective methods . Your answer will be no since we cannot see the code or implementation details of amethod which is written by third party ( in this case it is microsoft ) . But you can see the method definition , the input parameters as well as return type of the method . This is what is called as abstraction . In case of all the three methods , Microsoft is exposing only the required details ( that is method name , input types and return types ) but they are not exposing the implementation details of the method this is what is called as abstraction . Note: Try to right click on WriteLine method in visual studio and click on Go To definition option for getting more clarity . Hope this helps .

    • 15
  • Mahesh Kumar Alanka
    Apr, 2014 26

    A "Person" is the Example of OOPS. Skin hides the Heart methods, Body methods,........ as we donot need to know the implementation. we just know the body parts are working or not PERSON -- CLASS PART -- OBJECT TASK -- method ABSTRACTION -- donot want to know how parts work ENCAPSULATION - gives protection to our body with our clothes inheritence -- blood travels and inherits from one part to another POLYMORPHISM -- Brain function MAHESH KUMAR ALANKA http://about.me/alankasmahesh

    • 9
  • Mohamed Abd Elaleem
    Sep, 2014 8

    i dont know

    • 6
  • Deepak Ratan
    May, 2015 21

    A Laptop consists of many things such as processor, motherboard, RAM, keyboard, LCD screen, wireless antenna, web camera, usb ports, battery, speakers etc. To use it, you don't need to know how internally LCD screens, keyboard, web camera, battery, wireless antenna, speaker's works. You just need to know how to operate the laptop by switching it on. Think about if you would have to call to the engineer who knows all internal details of the laptop before operating it. This would have highly expensive as well as not easy to use everywhere by everyone.

    • 4
  • Krishna Yadav
    Apr, 2014 12

    "abstraction is the process which hiding unreliable data or information who are not related to use but still present over there." for real time example is wiring of the electricity under the wall which is hide and we use only its related features like bulb, fan, etc anything which is connected it.

    • 4
  • Munesh Sharma
    Apr, 2014 12

    Abstraction — Abstraction is "the process of identifying common patterns that have systematic variations; an abstraction represents the common pattern and provides a means for specifying which variation to use" (Richard Gabriel). An abstract class is a parent class that allows inheritance but can never be instantiated. Abstract classes contain one or more abstract methods that do not have implementation. Abstract classes allow specialization of inherited classes.In the real world, you never calculate the area or perimeter of a generic shape, you must know what kind of geometric shape you have because each shape (eg. square, circle, rectangle, etc.) has its own area and perimeter formulas. The parent class shape forces all derived classes to define the behavior for CalculateArea() and CalculatePerimeter(). Another great example is a bank account. People own savings accounts, checking accounts, credit accounts, investment accounts, but not generic bank accounts. In this case, a bank account can be an abstract class and all the other specialized bank accounts inherit from bank account.Hope it helps. Thanks

    • 3
  • Pankaj  Kumar Choudhary
    Mar, 2015 21

    we can take an example of an car. we can see the wheels, engine and can hear the horn of an car but we don't know that how they are working. because their internal mechanism is hidden from us we only know that it is working but how we don,t know . it is type of abstraction ..............

    • 2
  • Mohamed Abd Elaleem
    Sep, 2014 8

    gfgfggfggg

    • 2
  • Dileep Kumar Patel
    Apr, 2014 3

    Like ride a bike you dont know how to work your bike but you ride sucessfully.

    • 2
  • Bharatbhushan Sharma
    Feb, 2018 25

    On this Portal , [ interview -question ] is common interface and it is used by different objects [ users ] , every object having different features (different questions and answers ),so, here process of picking the essence of an object you really need is Abstraction.

    • 1
  • Mukesh Kumar
    Aug, 2017 29

    Abstraction means hiding the complexity like we have mobile ,we use only appsbut dont know about its functional complexity

    • 1
  • ramakotaiah patti
    Dec, 2016 22

    abstraction means for example u will take one abstract class and some abstract methods(means these are non-implemented methods ) these methods where ever in derived class you want to implement then we can override that methods this is the concept of the abstraction..... note:1)abstract class can also have non abstract methods also.2)abstract class means we can't create instance for that class but we can create objects only in derived class. example:namespace ConsolePractice {public abstract class vehicle{public abstract void move();public abstract void waight();void running(){Console.WriteLine("vehicle running with some speed");}}class bike:vehicle{public override void move() {Console.WriteLine("the bike running with 100km/hr");}public override void waight() {Console.WriteLine("the bike waighting is 150kgs"); }static void Main(string[] args) {bike b=new bike();b.move();b.waight();Console.ReadLine(); }}}note:encapsulation only can hiding internal implementation

    • 1
  • Rahul Sharma
    Oct, 2016 18

    like as when integer is converting into string using toString() method. it converts into string and we have to not worry about its conversion. It is an abstraction

    • 1
  • Santokh Singh
    Apr, 2016 9

    Abstraction Is Design time process.. When you drive a car and use cell phone then you are only aware of the interface provide to you like to shift the gear, to drive, to make a call, to send text. and even you don't have to know about the internal functionalities. That is abstraction provided in CAR/CELL Phone. abstract class CellPhone { abstract void MakeCall(); } class Nokia:CellPhone { override MakeCall() { } }

    • 1
  • Vikas Rai
    Apr, 2016 8

    Have you tried calling Response.Write method or Console.Write or WriteLine method any time from your code ( most probably yes ) . Now the next question is have you ever observed the code written by microsoft engineers in the respective methods . Your answer will be no since we cannot see the code or implementation details of amethod which is written by third party ( in this case it is microsoft ) . But you can see the method definition , the input parameters as well as return type of the method . This is what is called as abstraction . In case of all the three methods , Microsoft is exposing only the required details ( that is method name , input types and return types ) but they are not exposing the implementation details of the method this is what is called as abstraction . Note: Try to right click on WriteLine method in visual studio and click on Go To definition option for getting more clarity . Hope this helps .

    • 1
  • Pankaj  Kumar Choudhary
    Aug, 2015 29

    "abstraction is the process which hiding unreliable data or information who are not related to use but still present over there." for real time example is wiring of the electricity under the wall which is hide and we use only its related features like bulb, fan, etc anything which is connected it.

    • 1
  • Pankaj  Kumar Choudhary
    Aug, 2015 29

    "abstraction is the process which hiding unreliable data or information who are not related to use but still present over there." for real time example is wiring of the electricity under the wall which is hide and we use only its related features like bulb, fan, etc anything which is connected it.

    • 1
  • Joginder Banger
    Nov, 2014 10

    f you want to make a new car(WagonX) in which all the another car's properties are included like color,size, engine etc.and you want to add some another features like model,baseEngine in your car.Then simply you create a abstract class WagonX where you use all the predefined functionality as abstract and another functionalities are concrete, which is is defined by you. Another sub class which extend the abstract class WagonX,By default it also access the abstract methods which is instantiated in abstract class.SubClasses also access the concrete methods by creating the subclass's object.

    • 1
  • Farhan Ahmed
    Aug, 2014 12

    Abstraction : It is name of process. like Google map to achieve your desire location. If you want search location of Gulberg(Area Name) in Karachi city Following steps we will perform. 1: search Country 2: Search City 3:location these process known as Abstraction. Basically we remove UN-necessary Countries and cities to achieved our desire location.ENCAPSULATION : In above example How Google worked to achieved our location. [Means hide Implementation ] known as Encapsulation.

    • 1
  • Azeem attari
    Mar, 2018 26

    Encapsulation is used to hide its members from outside class or interface, whereas abstraction is used to show only essential features.

    • 0
  • Azeem attari
    Mar, 2018 26

    Encapsulation is used to hide its members from outside class or interface, whereas abstraction is used to show only essential features.

    • 0
  • Azeem attari
    Mar, 2018 26

    Encapsulation is used to hide its members from outside class or interface, whereas abstraction is used to show only essential features.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS