来自MVA视频的C#问题 [英] C# question from MVA videos

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

问题描述

我在观看了一个关于软件开发的视频后进行了短短五分钟的测验,我得到了一个错误的问题,但在我弄错之后它不会给我答案。我选择了函数,这是不正确的。



以下哪项用于管理和修改类中变量的内容?



A.对象

B.方法

C.财产

D.功能



我尝试过:



我在软件开发上观看了MVA视频并得到了问题错误。

解决方案

这不是一个好问题。让我们看看为什么。



1. C#中没有使用术语功能。它被术语方法取代。因此,排除最后一个选项。

2.属性是封装私人成员的一种方式。它有助于隐藏与变量关联的类内部。它绝对有助于管理私人成员。

3.方法当然也可用于操纵变量。但恕我直言,这不是他们唯一的目的应该是什么。我的意思是这样的事情没有多大意义:



  public   void  SetSomeVariable( string  valueToChange){
somePrivateString = valueToChange;
}





因此,我也会这样做。

4.对象一个类是访问该类的任何非静态成员所需的。这是我们处理非静态(实例)成员的先决条件。



如上所述,我会说使用对象的属性用于管理基于实例的私有成员


I took a short five minute quiz after watching a video on Software Development and I got one question wrong, but it won't show me the answer after I got it wrong. I chose function and that was incorrect.

Which of the following is used to manage and modify the content of variables in a class?

A. Object
B. Method
C. Property
D. Function

What I have tried:

I watched the MVA video on Software Development and got the question wrong.

解决方案

It is not a good question. Let us see why.

1. Term function is not used in C#. It is replaced by term method. So that rules out last option.
2. Property is a way to encapsulate your private members. It helps hiding the class internals that are associated with the variable. It definitely is something that helps managing private members.
3. Method can of course be used to manipulate variables as well. But IMHO that is not really what their only purpose should be. I mean something like this would not really make much sense:

public void SetSomeVariable(string valueToChange){
somePrivateString = valueToChange;
}



Hence, I would rule that out as well.
4. Object of a class is what is needed to access any non-static member of the class. It is a prerequisite if we are dealing with non static (instance) members.

Looking at above, I would say properties with objects are used to manage instance based private members.


这篇关于来自MVA视频的C#问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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