六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 45|回复: 0

为什么要在定义抽象类时使用abstract关键字

[复制链接]

升级  23.3%

478

主题

478

主题

478

主题

探花

Rank: 6Rank: 6

积分
1466
 楼主| 发表于 2013-2-5 01:18:16 | 显示全部楼层 |阅读模式
本文为原创,如需转载,请注明作者和出处,谢谢!

<div class="post"><link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C02%5Cclip_filelist.xml"><!--[if gte mso 9]><xml>Normal07.8 磅02falsefalsefalseMicrosoftInternetExplorer4</xml><![endif]--><!--[if gte mso 9]><![endif]--><style><!--/* Font Definitions */@font-face{font-family:宋体;panose-1:2 1 6 0 3 1 1 1 1 1;}@font-face{font-family:""@宋体";panose-1:2 1 6 0 3 1 1 1 1 1;}/* Style Definitions */p.MsoNormal, li.MsoNormal, div.MsoNormal{mso-style-parent:"";margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:inter-ideograph;font-size:10.5pt;font-family:"Times New Roman";}/* Page Definitions */@page{}@page Section1{size:595.3pt 841.9pt;margin:72.0pt 90.0pt 72.0pt 90.0pt;layout-grid:15.6pt;}div.Section1{page:Section1;}--></style><!--[if gte mso 10]><style>/* Style Definitions */table.MsoNormalTable{mso-style-parent:"";font-size:10.0pt;font-family:"Times New Roman";}</style><![endif]--> 众所周之,在任何面向对象的语言中(包括Java、C#),在定义抽象类时必须使用abstract关键字。虽然这已经习已为常了,但实际上abstract是为了在实现接口或继承抽象类避免歧议而必须存在的。
看如下代码:
<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->abstractclassClass1
{
abstractvoidmethod();
}
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表