OOP示例类结构 [英] OOP example class structure

查看:108
本文介绍了OOP示例类结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我正在寻找OOP类结构的好例子。包含带有属性,方法等的基类的方法 - 大多数我执行属性 - 类似于Animal类或Shape,但更复杂,可以说:



汽车(基础) - >汽车(继承自汽车) - >日产(继承汽车)

- >摩托车(继承自汽车) - > Hayabusa(继承自摩托车





现在完全不同的级别(不继承上述任何一种)让我们说:





发动机(等级),例如日产和隼鸟通过拍摄他们的房产来比较检查速度的力量



我想要实现的是我想看看如何在从基类开始的不同类中实现属性。有人能给出这样的例子吗?

hi all,

im looking for good example of OOP class structure. Means containing base class with properties, methods and so on - mostly I carry out to Properties - something like Animal class or Shape but more complex that lets say:

Automobile(Base) -> Car (inheriting from Automobile) -> Nissan (inheriting from Car)
-> Motorbike (inheri from Automobile) -> Hayabusa (inheriting from Motorbike


and now completely different class (not inheriting from any of above) let's say:


Engine (class) which would take e.g Nissan and Hayabusa to compare check power of speed by taking their properties, fields

What I want to achive is I would like to see how properties should be implemented over different classes beginning from base class. Could anyone give such example?

推荐答案

我们不做你的作业:这是有原因的。它是在那里让你考虑你被告知的事情,并试着理解它。它也在那里,以便你的导师可以识别区域在你身体虚弱的地方,把注意力集中在补救行动上。



亲自尝试一下,你可能会发现它并不像你想象的那么难!



如果您有特定问题,请随时询问或发布你对良好结构的想法,我们愿意为你批评它。但是我们不打算为你做好准备让你交出来!
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

If you have a specific question, then feel free to ask about that, or post up your idea of a good structure and we will be willing to critique it for you. But we aren't about to do it for you ready for you to hand in!


在互联网上有数百个C#教程,或者你可以直接去 http://msdn.microsoft.com/en-gb/vstudio/hh341490.aspx [<一个href =http://msdn.microsoft.com/en-gb/vstudio/hh341490.aspxtarget =_ blanktitle =新窗口> ^ ]。
There are hundreds of C# tutorials to be found on the internet, or you could go direct to http://msdn.microsoft.com/en-gb/vstudio/hh341490.aspx[^].


class


这篇关于OOP示例类结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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