类属性 [英] class properties

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

问题描述

我有一个关于这种情况的问题:


i有一个我使用的类,我需要知道

a中存在的1个数据类。我想知道将我需要

的属性添加到第一个类而不是必须实例化整个其他类

的单个属性是错误的吗?


如果不是很糟糕,你会在哪里画出重复的物品?你有b $ b吗?


谢谢洞察力

i have a question about this situation:

i have a class that i use that i need to know 1 piece of data that exists in
a different class. Im wondering is it wrong to add the property that i need
onto the first class instead of having to instantiate the whole other class
for a single property?

If it isn''t bad, where would you draw the line on what duplicated properties
you have?

thanks for the insight

推荐答案

类继承是正确的答案吗?


公共类MyClass:MyNameSpace.MyOtherClass

{

}


-

2004和2005 Microsoft MVP C#

Robbe Morris
http://www.masterado.net


赚取
Is class inheritance the right answer?

public class MyClass : MyNameSpace.MyOtherClass
{
}

--
2004 and 2005 Microsoft MVP C#
Robbe Morris
http://www.masterado.net

Earn


钱回答.NET Framework

EggHeadCafe.com上的留言板帖子。
http://www.eggheadcafe.com/forums/merit.asp


TS <毫安********** @ nospam.nospam>在消息中写道

新闻:e1 ************** @ TK2MSFTNGP15.phx.gbl ...
money answering .NET Framework
messageboard posts at EggHeadCafe.com.
http://www.eggheadcafe.com/forums/merit.asp

"TS" <ma**********@nospam.nospam> wrote in message
news:e1**************@TK2MSFTNGP15.phx.gbl...
我有一个关于这种情况:

我有一个我使用的课程,我需要知道在另一个班级中存在的1个数据。我想知道在第一堂课上添加我需要
的财产而不必为单一财产实例化其他
课程是不对的吗?

如果不是坏的话,你会在哪里画出你所拥有的重复的
属性?

感谢您的洞察力
i have a question about this situation:

i have a class that i use that i need to know 1 piece of data that exists
in
a different class. Im wondering is it wrong to add the property that i
need
onto the first class instead of having to instantiate the whole other
class
for a single property?

If it isn''t bad, where would you draw the line on what duplicated
properties
you have?

thanks for the insight



类继承是正确答案吗?


公共类MyClass:MyNameSpace.MyOtherClass

$

-

2004年和2005年微软MVP C#

Robbe Morris
http://www.masterado.net

赚取
Is class inheritance the right answer?

public class MyClass : MyNameSpace.MyOtherClass
{
}

--
2004 and 2005 Microsoft MVP C#
Robbe Morris
http://www.masterado.net

Earn


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

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