c# 类对象和实例对象
A static method of a class can never receive the "this" reference.
We can modify "this" reference in the instance method of a class.
When we are calling an instance method of a class, it is not required to pass "this" reference explicitly.
An instance method of a class is always receiving the "this" reference.
Options:
Correct answer: 4
A, C and D
In the given statements, A, C and D are correct statements.
类的静态方法永远不会收到“ this”引用。
我们可以在类的实例方法中修改“ this”引用。
当我们调用类的实例方法时,不需要显式传递“ this”引用。
类的实例方法始终接收“ this”引用。
选项:
正确答案:4
A,C和D
在给定的语句中,A,C和D是正确的语句。
All Objects of "MyClass" may have the same or different data members.
All Objects of "MyClass" have the same data members.
All Objects of "MyClass" will share the same copy of methods.
Objects of "MyClass" will have the same or different data members depends upon the project setting in Visual Studio.
Options:
Correct answer: 4
B and C
In the given statements, B and C are correct statements.
“ MyClass”的所有对象可能具有相同或不同的数据成员。
“ MyClass”的所有对象都具有相同的数据成员。
“ MyClass”的所有对象将共享相同的方法副本。
“ MyClass”的对象将具有相同或不同的数据成员,具体取决于Visual Studio中的项目设置。
选项:
正确答案:4
B和C
在给定的语句中,B和C是正确的语句。
Test T = new Test();
Here we creating object "Test".
Here we are creating an object of class "Test".
Here we are creating an object of class "Test" on the stack.
Here we are creating reference "T" on the stack and object of the type "Test" on the heap.
Options:
Correct answer: 4
B and D
In the given statements, B and D are correct statements.
在这里,我们创建对象“ Test”。
在这里,我们正在创建“测试”类的对象。
在这里,我们在堆栈上创建一个“ Test”类的对象。
在这里,我们在堆栈上创建引用“ T”,并在堆上创建类型为“ Test”的对象。
选项:
正确答案:4
B和D
在给定的语句中,B和D是正确的语句。
Test T1 = new Test();
Test T2 = new Test();
The value of T1 and T2 will be same exactly.
Here we create two objects of Test class in the stack.
The two objects of a class that will always create in adjacent memory locations.
Here we create two objects of Test class.
Options:
Correct answer: 4
Only D
In the given statements, only D is a correct statement.
T1和T2的值将完全相同。
在这里,我们在堆栈中创建Test类的两个对象。
一个类的两个对象将始终在相邻的内存位置中创建。
在这里,我们创建两个Test类的对象。
选项:
正确答案:4
只有D
在给定的语句中,只有D是正确的语句。
using System;
public class Sample
{
static public void Main()
{
int A = 0;
int B = new int();
string S1 = "";
string S2 = "";
A = 123;
B = 456;
S1 = A.ToString();
S2 = B.ToString();
Console.WriteLine(S1+", "+S2);
}
}
Correct answer: 1
123, 456
The above will print (123, 456) on the console screen.
翻译自: https://www.includehelp.com/dot-net/csharp-class-object-aptitude-questions-and-answers-2.aspx
c# 类对象和实例对象