为什么我们创建静态和抽象类! [英] Why we create static and abstract class!

查看:113
本文介绍了为什么我们创建静态和抽象类!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



让我知道为什么我们创建静态和抽象类。

我们知道我们无法实例化静态类和非常快

所以为什么我们不创建每个类作为静态类..

为什么我们创建公共类的对象。



当抽象类和公共类需要静态类时.....

解决方案

不同的类型有特定的用途,很少见关于速度。您可以查看一些这些链接 [ ^ ]及其他信息,以获取更多信息。

静态类意味着您将在一个地方设置值并从其他位置你会得到那个值,在那个时候最好使用静态类。例如效用类。



为什么我们需要抽象类?这个链接会向你解释清楚

http://stackoverflow.com/questions/9652506/why-we-need-abstract-class-when-we-can-inherit-normal-class [ ^ ]



希望这有帮助


有很多理由为什么静态和抽象类被创建,但要缩短它。使程序运行得更快。想象一下,如果您使用的是程序类型的编程。如果您正在为大型系统工作,开发人员/程序员很难调试他们的程序。这就是为什么我们的专业医生和工程师增强编程类型并创建面向对象的编程,以便所有开发人员和程序员使他们的生活更轻松,更容易调试。因此,我们的智能开发人员和程序员开发的这个OOP的一部分是抽象和静态的。所以如果你想开发一个程序,这非常重要。 :)

Hi All,

Let me know why we create static and abstract class.
we know that we can't instantiate static class and is very fast
so why we not create every class as static class..
why we create objects of public class.

when we need static class when abstract class and when public class.....

解决方案

Different types have specific uses, and it's rarely about speed. You can look at some of these links[^], and others, for more information.


Static class is used when you are aware of that the value that you are going to use in entire application will remain same means that at one place you will set the value and from other place you will get that value, at that point of time it's better to use static class.For example Utility classes.

Why we need abstract classes? this link will explain you clearly
http://stackoverflow.com/questions/9652506/why-we-need-abstract-class-when-we-can-inherit-normal-class[^]

Hope this helps


There are a lot of reason why that static and abstract class created but to make it short. To make your program run faster. Imagine if you are using a procedural type of programming. It is hard for the developer/programmer to debug their program especially if you are working for a large system. That's why our doctors' and engineers' in professions enhance the type of programming and create an Object Oriented Programming in order for all the developer and programmer make their life easier and easy to debug. so part of this OOP develop by our smart developer and programmer are Abstract and static.So this is very important if you want to develop a program. :)


这篇关于为什么我们创建静态和抽象类!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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