|
System.ValueType - sealed или нет?
|
|||
---|---|---|---|
#18+
От него же наследуют структуры, значит он не sealed. Наследники вроде Int32 - они вроде sealed, от них наследовать нельзя. ... |
|||
:
Нравится:
Не нравится:
|
|||
30.06.2015, 21:53 |
|
System.ValueType - sealed или нет?
|
|||
---|---|---|---|
#18+
Абстрактный класс не может быть sealed. Что же до Int32 - он является структурой, а структуры все sealed - так определено на уровне CLI: Код: c# 1. 2. 3. 4.
IL: Код: c# 1. 2. 3. 4. 5.
... |
|||
:
Нравится:
Не нравится:
|
|||
01.07.2015, 06:12 |
|
System.ValueType - sealed или нет?
|
|||
---|---|---|---|
#18+
Ну, и как бы в букваре всё это есть: CLR via C#, Chapter 5: Primitive, Reference, and Value TypesIf you look more closely at the documentation, you’ll notice that all of the structures are immediately derived from the System.ValueType abstract type. System.ValueType is itself immediately derived from the System.Object type. By definition, all value types must be derived from System.ValueType. All enumerations are derived from the System.Enum abstract type, which is itself derived from System.ValueType. The CLR and all programming languages give enumerations special treatment. For more information about enumerated types, refer to Chapter 15, “Enumerated Types and Bit Flags.” Even though you can’t choose a base type when defining your own value type, a value type can implement one or more interfaces if you choose. In addition, all value types are sealed, which prevents a value type from being used as a base type for any other reference type or value type. So, for example, it’s not possible to define any new types using Boolean, Char, Int32, Uint64, Single, Double, Decimal, and so on as base types. ... |
|||
:
Нравится:
Не нравится:
|
|||
01.07.2015, 06:18 |
|
|
start [/forum/topic.php?fid=20&msg=38996455&tid=1401392]: |
0ms |
get settings: |
9ms |
get forum list: |
15ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
41ms |
get topic data: |
10ms |
get forum data: |
3ms |
get page messages: |
41ms |
get tp. blocked users: |
1ms |
others: | 18ms |
total: | 146ms |
0 / 0 |