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

Telegram Gives Up On Crypto Blockchain Project

Durov said on his Telegram channel today that the two and a half year blockchain and crypto project has been put to sleep. Ironically, after leaving Russia because the government wanted his encryption keys to his social media firm, Durov’s cryptocurrency idea lost steam because of a U.S. court. “The technology we created allowed for an open, free, decentralized exchange of value and ideas. TON had the potential to revolutionize how people store and transfer funds and information,” he wrote on his channel. “Unfortunately, a U.S. court stopped TON from happening.”

Unlimited members in Telegram group now

Telegram has made it easier for its users to communicate, as it has introduced a feature that allows more than 200,000 users in a group chat. However, if the users in a group chat move past 200,000, it changes into "Broadcast Group", but the feature comes with a restriction. Groups with close to 200k members can be converted to a Broadcast Group that allows unlimited members. Only admins can post in Broadcast Groups, but everyone can read along and participate in group Voice Chats," Telegram added.

telegram from ru


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