OOPS概念中的抽象 [英] Abstraction in OOPS Concepts

查看:64
本文介绍了OOPS概念中的抽象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能描述在c#.net中如何实现抽象.我知道什么是抽象类和所有概念性知识.....但不知道,我在哪里使用Abstraction ... ???

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

推荐答案

好吧,我们会开始它的理论,然后去实验室;)

我的英语老师最喜欢的一个问题是写故事的抽象".我们已经读过这个故事,然后必须以2-3行写出全部内容.因此,抽象就是从大量的班级中拿出重要的东西,并向外界提供帮助,以便他们可以使用它."如果您开着车,您见过齿轮箱机构"吗?否,因为我们有一个操纵杆(手柄)可以使用它.所以,这就是我所谓的外行人定义.

实用:

1. An interface 是Abstraction的示例:它包含要实现的方法的签名,但没有代码. Abstract classes.
的Simmilar
2. Getter and setter of property :在您的getter和setter内部,您获取并更改了内部变量,但外围世界(开发人员)只知道他在提供/获取客户的年龄或姓名等.

3. Delegates : 没有暗示只指向函数和事件.

4. LINQ :您使用过linq吗?尝试过Where()或任何量词?你知道里面发生了什么吗?它为您提供了访问内部代码的便利.

此答案的改进将受到高度重视.
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.


抽象是一个心理过程(请参见 Wikipedia [ ^ ]),它(几乎)与抽象类无关(即是C#语言实体).
抽象在OOP中非常有用(就像在许多其他知识领域一样),建议您读一本关于OOP的好书.
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.


如果您对抽象概念有概念上的了解然后跟随课程的链接可能会对您有所帮助.

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

http://www.dotnetperls.com/abstract [有关抽象类的所有信息. [
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.[^]


这篇关于OOPS概念中的抽象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆