MyClassBase或BaseMyClass?(MyClassBase or BaseMyClass? [duplicate])

编程入门 行业动态 更新时间:2024-10-27 09:47:41
MyClassBase或BaseMyClass?(MyClassBase or BaseMyClass? [duplicate])

可能重复: 在类名中使用“Base” C#类的命名约定:它是BaseClass还是ClassBase或AbstractClass 抽象类的命名约定

命名基本抽象类的更好方法是什么? 我仍然无法决定在哪里放置'Base'这个词。 应该是'BaseMyClass'还是'MyClassBase'?

你如何命名这些以及为什么?

Possible Duplicates: Using “Base” in a Class Name C# Class naming convention: Is it BaseClass or ClassBase or AbstractClass Naming Conventions for Abstract Classes

What is the better way to name base abstract classes? I still can't decide where to put 'Base' word. Should it be 'BaseMyClass' or 'MyClassBase'?

How do you name those and why?

最满意答案

想象一下,如果你有一连串的抽象类,你会把它叫做MyClassBaseBaseBase吗?

如果可以的话,避免使用名字中的“Base”。 你有一个抽象基类,因为它比你的具体实现更具通用性。 然后以更通用的方式命名它,描述它为派生类提供的共同基础。

如果因为某种原因不能完成上述工作,我同意上一张海报; 使用MyClassBase。

Imagine if you have a chain of abstract classes, would you call it MyClassBaseBaseBase then?

Avoid the use of "Base" in your name if you can. You have an abstract base class because it's somehow more generic than your concrete implementation. Name it in a more generic way then, describing what common ground it supplies for deriving classes.

If the above cant be done for some reason, I agree with the previous poster; use MyClassBase.

更多推荐

本文发布于:2023-08-02 21:18:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1381458.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:MyClassBase   BaseMyClass   duplicate

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!