C#
Which of t ...
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
Which of the following definitions of abstract classes are correct in C#?
Abstract classes can not inherit from interfaces
Abstract classes cannot be inherited from
Fields cannot be defined within an abstract class
An object of an abstract class cannot be instantiated
Abstract class can contain both abstract and virtual members in it
Explanation
According to abstract class definition it is impossible to instantiate an object of an abstract class. Abstract class can contain both abstract and virtual members - this is not forbidden.
abstract class
virtual methods
Like
Login in
to like
Comment
Login in
to comment
Share
Tweet
Related Content
public abstract class A { public string PublicPrint() { return Print(); } protected virtual string Print() { return "A"; } } public class B : A { } public class C : B { protected override string Print() { return "C"; } } Каков будет результат при выполнении следующего кода: A ac = new C(); Console.WriteLine(ac.PublicPrint());
Что выведет данный код? 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(); } }
public abstract class A { public virtual string Print() { return "A"; } } public class B : A { public override string Print() { return "B"; } } public class C : B { public new string Print() { return "C"; } } Каков будет результат при выполнении следующего кода: A ac = new C(); Console.WriteLine(ac.Print());
public abstract class A { public virtual string Print(){return "A";} } public class B:A { public virtual new string Print(){return "B";} } public class C:B { public override string Print(){return "C";} } Каков будет результат при выполнении следующего кода: A ac = new C(); Console.WriteLine(ac.Print());
Укажите отличия интерфейса от абстрактного класса
C
#
Quiz
Login to learn C#
or
Read more about
C# Quizzes
Follow CodeGalaxy
Mobile Beta
Send Feedback
Keep exploring
C# quizzes
Лямбда-выражения на платформе .Net могут существовать в виде:
Скомпилируется ли данный фрагмент кода успешно? private int GetID (string inputText) { if (inputText != "") return 1; else if (inputText == "") return 0; }
Для чего предназначен метод Finalize?
Поддерживает ли С# перегрузку методов на основе возвращаемого значения?
public abstract class A { public virtual string Print() { return "A"; } } public class B : A { public override new string Print() { return "B"; } } public class C : B { public string Print() { return "C"; } } Каков будет результат при выполнении следующего кода: A ac = new C(); Console.WriteLine(ac.Print());
Какие из перечисленных ключевых слов используются в конструкции "если":
Sign Up Now
or
Subscribe for future quizzes
Login in to like
Login in to comment