-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInheritance.cs
48 lines (39 loc) · 1.2 KB
/
Inheritance.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Collections.Generic;
using System.Text;
namespace Nullable_warnings_demo
{
/// <summary>
/// //CS8609: Nullability of reference types in return type doesn't match overridden member
/// //CS8610: Nullability of reference types in type of parameter 'XXX' doesn't match overridden member.
/// </summary>
public class User
{
public virtual string FirstName { get; set; } = "";
public virtual System.Action<string> Hello(System.Action<string> x)
{
return null!;
}
}
public class SubUser : User
{
public override string? FirstName { get; set; } //CS8609
public override System.Action<string> Hello(System.Action<string?> x) //CS8610
{
return null!;
}
}
public abstract class A
{
public abstract List<string> UserNames( List<string> data);
public abstract List<string> FirstName { get; set; }
}
public abstract class B : A
{
public override List<string?> FirstName { get; set; } //CS8609
public override List<string> UserNames( List<string> data)
{
return FirstName;
}
}
}