Click here to Skip to main content
11,707,470 members (72,869 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# oops
Can anyone describe that how to achieve abstraction in c#.net. I know what is abstract class and all conceptual knowledge..... but dont know, where i am using Abstraction...???
Posted 26-Nov-12 2:15am
Lijjat645
Comments
sinhasourabh at 26-Nov-12 8:23am
   
It is a good question if you are a beginner. Writing down the answer.
Rate this: bad
good
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.
  Permalink  
Rate this: bad
good
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.
  Permalink  
Comments
Sushil Mate at 1-Jun-15 1:32am
   
just stumbled upon this question from nowhere.. you have written good answers before & this one kind of misleading to OPs. would you like reconsider your answer?
mainly "it has (almost) nothing to do with abstract class (that is a C# language entity)".
Rate this: bad
good
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.

http://msdn.microsoft.com/en-us/library/sf985hc5.aspx[^]

http://www.dotnetperls.com/abstract[^]

All about abstract classes.[^]
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 156
1 Sergey Alexandrovich Kryukov 145
2 Mika Wendelius 140
3 chainerlt 110
4 ppolymorphe 104
0 OriginalGriff 9,178
1 Sergey Alexandrovich Kryukov 8,562
2 CPallini 5,189
3 Maciej Los 4,806
4 Mika Wendelius 3,706


Advertise | Privacy | Mobile
Web01 | 2.8.150819.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