Click here to Skip to main content
12,956,197 members (104,592 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
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
Lijjat683
Comments
sinhasourabh 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 ;)

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 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
Top Experts
Last 24hrsThis month
OriginalGriff 6,869
CHill60 3,550
Maciej Los 3,243
ppolymorphe 2,070
Jochen Arndt 1,973


Advertise | Privacy | Mobile
Web01 | 2.8.170525.1 | Last Updated 26 Nov 2012
Copyright © CodeProject, 1999-2017
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