Quizzes
Site Language: English
Українська
English
Русский
Programming Tests
Login
Sign Up
Programming Tests
Theory
Snippets
Papers
Landing
Android
Prices
FAQ
Cosmo Story
Terms and Conditions
Privacy Policy
Cookies Policy
Send Feedback
class definition
:
Content language: Русский
English
Укажите ошибки в коде: using Systеm; nаmеsрасе Q { сlаss Nаmе { #rеgiоn Cоnstruсtоr рubliс Nаmе(string nаmе) { this.Nаmе = nаmе; } #еndrеgiоn #rеgiоn Рrореrtiеs /*1*/ рubliс string Nаmе { рrivаtе sеt; gеt; } #еndrеgiоn #rеgiоn Меthоds stаtiс vоid Маin(string[] аrgs) { /*2*/ Nаmе n = nеw Nаmе("Hеlо Wrоld"); /*3*/ n.Disроsе(); // освобождаем память. } #еndrеgiоn } }
class definition
Какие изменения нужно сделать в классе, чтобы он компилировался public class Foo { private int[] a = new int[10]; private Dictionary<string, int> b; private int[] c = new int[100]; public int this[int i] { // 1 get { return a[i]; } set { a[i] = value; } } public int this[string id] { // 2 get { return b[id]; } set { b[id] = value; } } public int this[int i, int j] { // 3 get { return c[i*10 + j]; } set { c[i*10 + j] = value; } } }
class definition
Что выведет данный код? abstract class A { public virtual void Method1() { Console.WriteLine("A.Method1"); } public abstract void Method2(); } class B:A { public override void Method1() { Console.WriteLine("B.Method1"); } } class Program { public static void Main(string[] args) { A a = new B(); a.Method1(); } }
class definition
В каких строках кода допущены ошибки? using System; namespace Inheritance { class A { } interface Inner { } struct S : A, Inner //1 { int num = 10; //2 public S() //3 { } static S() //4 { } } class Program { static void Main(string[] args) { S obj = new S(); //5 } } }
class definition
Что выведет на консоль следующая программа: using System; namespace TestCS { class Program { public delegate void MethodDelegate(string param); private void privateMethod(string str) { Console.Write(str); } public void GetMeth(out MethodDelegate md) { md = privateMethod; } static void Main(string[] args) { MethodDelegate myMethod; Program program = new Program(); program.GetMeth(out myMethod); myMethod("Hello"); Console.Write("_world"); Console.ReadKey(); } } }
class definition
Какие модификаторы доступа из перечисленных по умолчанию даются классу, описанному в namespace?
class definition
Скомпилируется ли данный код? internal sealed class SomeGenericClass<T> { public static T SomeMethod() { return new T(); } }
class definition
← Prev
1
Next →
Sign Up Now
or
Subscribe for future quizzes