Click here to Skip to main content
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 3:15am
Lijjat672
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  
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 250
1 George Jonsson 175
2 Jochen Arndt 150
3 Kornfeld Eliyahu Peter 149
4 PIEBALDconsult 110
0 OriginalGriff 6,080
1 DamithSL 4,648
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,624
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 26 Nov 2012
Copyright © CodeProject, 1999-2014
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