Click here to Skip to main content
11,492,974 members (59,459 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# oops
Can anyone describe that how to achieve abstraction in I know what is abstract class and all conceptual knowledge..... but dont know, where i am using Abstraction...???
Posted 26-Nov-12 3:15am
sinhasourabh at 26-Nov-12 8:23am
It is a good question if you are a beginner. Writing down the answer.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Well we will start it's theory and then go the labs Wink | ;)

One the most fav question of my english teacher was, 'write the abstraction of the story'. We have read the story and then have to write entire stuff in 2-3 lines. So abtraction is 'taking out the important stuff from a huge class and providing a handel to outer world so that they can use it.' If you have drove a car, did you ever saw the 'Gear Box Mechanism'? No, because we have a lever (handel) to access it. So, this was my so called lay man defination.

Practical :

1. An interface is example of Abstraction : It contains signature of methods to be implimented, but have no code. Simmilar for Abstract classes.

2. Getter and setter of property : Inside your getter and setter you fetch and change your internal variables but the outerworld (developer), only knows that he is provide / getting age or name etc of a customer.

3. Delegates : No implimentation only points to functions and events.

4. LINQ : have you used linq ? Tried Where() or any quantifer ? Do you know what happens inside ? It give you an handel to access the inside code.

Improvement of this answer will be highly appriciated.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Abstraction is a mental process (see Wikipedia[^]) , it has (almost) nothing to do with abstract class (that is a C# language entity).
Abstractions are very useful in OOP (like in many other areas of knowledge), you are encouraged to read a good book on OOP.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

If you have conceptual idea of what abstract class is then following links might be helpful to you for achieving the same.[^][^]

All about abstract classes.[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 419
1 Maciej Los 286
2 F-ES Sitecore 224
3 KarstenK 210
4 CPallini 208
0 Sergey Alexandrovich Kryukov 10,132
1 OriginalGriff 8,630
2 Sascha Lefèvre 3,624
3 Maciej Los 3,392
4 Richard Deeming 2,500

Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 26 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100