18
Reply

Give me the real time example of abstraction in c#.

Mahesh Alle

Mahesh Alle

Mar 24, 2014
60.2k
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 .

    Palle Technologies
    April 02, 2014
    11

    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

    Mahesh Kumar alanka
    April 26, 2014
    6

    i dont know

    Mohamed Abd Elaleem
    September 08, 2014
    5

    "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.

    Krishna Yadav
    April 12, 2014
    3

    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.

    Deepak Ratan
    May 21, 2015
    2

    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

    Munesh Sharma
    April 12, 2014
    2

    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 ..............

    gfgfggfggg

    Mohamed Abd Elaleem
    September 08, 2014
    1

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

    Dileep Kumar Patel
    April 03, 2014
    1

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

    Mukesh Kumar
    August 29, 2017
    0

    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

    ramakotaiah patti
    December 22, 2016
    0

    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

    Rahul Sharma
    October 18, 2016
    0

    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() { } }

    Santokh Singh
    April 09, 2016
    0

    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 .

    Vikas Rai
    April 08, 2016
    0

    "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.

    Pankaj Kumar Choudhary
    August 29, 2015
    0

    "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.

    Pankaj Kumar Choudhary
    August 29, 2015
    0

    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.

    Joginder Banger
    November 10, 2014
    0

    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.

    Farhan Ahmed
    August 12, 2014
    0