泛型
class Program
{
static void Main(string[] args)
{
B<int> s = new B<int>();
s.print(123);
s.prin(21);
Console.ReadKey();
}
}
abstract class A<T> //沒有固定是什麼類型所有更加靈活
{
public void prin(T t) {
Console.WriteLine(t);
}
}
class B<T> : A<T>
{
public void print(T t)
{
Console.WriteLine(t);
}
}
{
static void Main(string[] args)
{
B<int> s = new B<int>();
s.print(123);
s.prin(21);
Console.ReadKey();
}
}
abstract class A<T> //沒有固定是什麼類型所有更加靈活
{
public void prin(T t) {
Console.WriteLine(t);
}
}
class B<T> : A<T>
{
public void print(T t)
{
Console.WriteLine(t);
}
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
今天!通義靈碼在北京、成都、杭州三城開講啦
原創
2024-05-27 21:13:46
DevExpress Office File API中文教程 - 如何用OpenAI模型增強Office文檔可訪問性?
原創
2024-05-25 00:20:55
WinForm應用實戰開發指南 - 如何完成樹形列表(TreeList)的快捷綁定?
界面開發小八哥
2024-05-20 12:20:54
爲程序員和新手準備的 8 大 Python 工具
osc_7cws6vmd
2024-05-14 01:06:43
通義靈碼企業版正式發佈,滿足企業私域知識檢索、數據合規、統一管理等需求
原創
2024-05-11 21:15:01
我們團隊來了一位新同事,主動要求幫忙敲代碼!歡迎 AI 001號
原創
2024-05-07 21:12:06
界面組件DevExpress Blazor UI v23.2 - 網格、工具欄功能全新升級
原創
2024-04-29 11:35:41
界面控件DevExpress Office File API中文教程 - 如何實現PDF轉換?
原創
2024-04-26 11:35:59
西安站開營!AI 編碼助手通義靈碼幫大學生“整活兒”
原創
2024-04-24 21:12:06
界面組件DevExpress Blazor UI v23.2 - 支持.NET 8、全新的項目模版
原創
2024-04-23 11:34:47
界面組件DevExpress WinForms v23.2 - 數據展示、UI模板功能全新升級
原創
2024-04-16 11:35:01
vs2022 工具集合
原創
2024-04-15 22:24:23
WinForm應用實戰開發指南 - 如何實現類似事件總線的消息處理?
界面開發小八哥
2024-04-15 11:35:27
界面組件DevExpress WinForms v23.2 - 功能區、富文本編輯器功能升級
原創
2024-04-09 11:34:25