在C#中需要类引用 [英] need for class references in C#
本文介绍了在C#中需要类引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
c#或任何编程语言中类引用的用途是什么
就像
myclass m;
m = new myanotherclass();
将m声明为一个类的对象并将其引用给另一类的需求是什么?
任何帮助将不胜感激.
谢谢.
Hi
What is the use of class references in c# or any programming languages
like
myclass m;
m=new myanotherclass();
what is the need of declaring m as object of one class and referring it to another class?
Any help is greatly appreciated.
Thanks.
推荐答案
如果需要利用某个类的数据和行为,则可以使用一个类对象.
If you need to make use of data and behaviour of a certain class, you would do it using a class object.
这可能对您有帮助,
C#中的面向对象概念 [面向对象编程 [
It might helps you,
Object Oriented Concepts in C#[^]
Object-Oriented Programming[^]
:)
简单-您可能需要访问第二个类(myanotherclass)中的某些内容(属性或方法).
在面向对象的术语中,这称为关联.
Simple - you probably need to either access something (property or method) in the second class (myanotherclass).
In object oriented terms this is known as an Association.
这篇关于在C#中需要类引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文