Telegram Group & Telegram Channel
Можно ли запретить наследование от какого-то класса?

Да, можно. Для того, чтобы запретить наследоваться от класса необходимо объявить его с модификатором sealed.

Например, если мы не хотим чтобы от класса SomeClass можно было наследоваться, то объявляем его так:

sealed class SomeClass
{
// Объявление класса
}

В качестве альтернативы, можно запретить и создание экземпляров этого класса с помощью ключевого слова static (под капотом, будет использована пара модификаторов: abstract sealed).

static class Helper
{
// допустимы лишь статические методы
}


🐸Библиотека собеса по С#
Please open Telegram to view this post
VIEW IN TELEGRAM



tg-me.com/csharp_interview_lib/654
Create:
Last Update:

Можно ли запретить наследование от какого-то класса?

Да, можно. Для того, чтобы запретить наследоваться от класса необходимо объявить его с модификатором sealed.

Например, если мы не хотим чтобы от класса SomeClass можно было наследоваться, то объявляем его так:

sealed class SomeClass
{
// Объявление класса
}

В качестве альтернативы, можно запретить и создание экземпляров этого класса с помощью ключевого слова static (под капотом, будет использована пара модификаторов: abstract sealed).

static class Helper
{
// допустимы лишь статические методы
}


🐸Библиотека собеса по С#

BY Библиотека собеса по C# | вопросы с собеседований


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/csharp_interview_lib/654

View MORE
Open in Telegram


telegram Telegram | DID YOU KNOW?

Date: |

What is Telegram?

Telegram is a cloud-based instant messaging service that has been making rounds as a popular option for those who wish to keep their messages secure. Telegram boasts a collection of different features, but it’s best known for its ability to secure messages and media by encrypting them during transit; this prevents third-parties from snooping on messages easily. Let’s take a look at what Telegram can do and why you might want to use it.

The SSE was the first modern stock exchange to open in China, with trading commencing in 1990. It has now grown to become the largest stock exchange in Asia and the third-largest in the world by market capitalization, which stood at RMB 50.6 trillion (US$7.8 trillion) as of September 2021. Stocks (both A-shares and B-shares), bonds, funds, and derivatives are traded on the exchange. The SEE has two trading boards, the Main Board and the Science and Technology Innovation Board, the latter more commonly known as the STAR Market. The Main Board mainly hosts large, well-established Chinese companies and lists both A-shares and B-shares.

telegram from kr


Telegram Библиотека собеса по C# | вопросы с собеседований
FROM USA