csgashine

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
Calling Base Class Constructors

Classes can't inherit constructors, a derived class must implement its own constructor and can only make use of the constructor of its base class by calling it explicitly.

if the base class has an accessible default constructor, the derived constructor is not required to invoke the base constructor explicitly; instead, the default constuctor is called implicitly.

However, if the base class doesn't have a default constructor, every derived constructor must explicitly invoke one of the base class constructors using the base keyword.
posted on 2006-04-18 11:05  asp-shine  阅读(293)  评论(1编辑  收藏  举报