클래스를 상속하지 못하게 막는 키워드가 있습니다. sealed 키워드입니다. Colored By Color Scripter 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 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace sealed_test { sealed class test { } class test2 : test { } class Program { static void Main(string[] args) { test2 t2 = new test2(); } } } 클래스의 앞에 sealed 키워드를 사용합니다. sealed를 사용한 클래스를 상속할 경우엔 오류가 나옵니다.
(코드상으로는 오류가 나타나지 않습니다. 컴파일시 오...
#
IT·컴퓨터
원문 링크 : [C#] sealed 키워드