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: |

China’s stock markets are some of the largest in the world, with total market capitalization reaching RMB 79 trillion (US$12.2 trillion) in 2020. China’s stock markets are seen as a crucial tool for driving economic growth, in particular for financing the country’s rapidly growing high-tech sectors.Although traditionally closed off to overseas investors, China’s financial markets have gradually been loosening restrictions over the past couple of decades. At the same time, reforms have sought to make it easier for Chinese companies to list on onshore stock exchanges, and new programs have been launched in attempts to lure some of China’s most coveted overseas-listed companies back to the country.

Telegram is riding high, adding tens of million of users this year. Now the bill is coming due.Telegram is one of the few significant social-media challengers to Facebook Inc., FB -1.90% on a trajectory toward one billion users active each month by the end of 2022, up from roughly 550 million today.

telegram from in


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