`
talin2010
  • 浏览: 500500 次
  • 性别: Icon_minigender_1
  • 来自: 河北
社区版块
存档分类
最新评论

17.10.1 Constructor initializers

阅读更多
All instance constructors (except those for class object) implicitly include
an invocation of another instance
constructor immediately before the constructor-body. The constructor to
implicitly invoke is determined by the
constructor-initializer:
? An instance constructor initializer of the form base(argument-listopt)
causes an instance constructor from
the direct base class to be invoked. That constructor is selected using
argument-list and the overload
resolution rules of §14.4.2. The set of candidate instance constructors
consists of all accessible instance
constructors declared in the direct base class, or the default constructor (
§17.10.4), if no instance constructors
are declared in the direct base class. If this set is empty, or if a single
best instance constructor cannot be
identified, a compile-time error occurs.
? An instance constructor initializer of the form this(argument-listopt)
causes an instance constructor from
the class itself to be invoked. The constructor is selected using
argument-list and the overload resolution rules
of §14.4.2. The set of candidate instance constructors consists of all
accessible instance constructors declared
in the class itself. If that set is empty, or if a single best instance
constructor cannot be identified, a compiletime
error occurs. If an instance constructor declaration includes a constructor
initializer that invokes the
constructor itself, a compile-time error occurs.
If an instance constructor has no constructor initializer, a constructor
initializer of the form base() is implicitly
provided. [Note: Thus, an instance constructor declaration of the form
C(?) {?}
is exactly equivalent to
C(?): base() {?}
end note]
The scope of the parameters given by the formal-parameter-list of an
instance constructor declaration includes
the constructor initializer of that declaration. Thus, a constructor
initializer is permitted to access the parameters
of the constructor. [Example: For example:
class A
{
public A(int x, int y) {}
}
class B: A
{
public B(int x, int y): base(x + y, x - y) {}
}
end example]
An instance constructor initializer cannot access the instance being
created. Therefore it is a compile-time error to
reference this in an argument expression of the constructor initializer, as
it is a compile-time error for an
argument expression to reference any instance member through a simple-name.
分享到:
评论

相关推荐

    AoeInstaller17.10.1.exe

    自动记录上次阅读位置,自动记录打开历史记录,十分简洁的一款电子书阅读器。

    MSSQLPHPGeneratorv17.10.1按设置对应字段生成php页面

    MS SQL PHP Generator 是一个强大的MS SQL Server的图形管理器,可以帮助你产生高品质的MS SQL Server-PHP脚本。 MS SQL PHP Generator的主要特点: 功能强大,用户友好: 1、 MS SQL PHP Generator是建设... ...

    系统优化组合WinTools.netProfessionalv17.10.1官方免费安装版

    WinTools.net 是一系列的系统优化组合软件,可以从系统中移除不需要的软件、清除 Windows 注册表中无用的项目、控制开机时所要自动开启的程序、内存监控、强力的自定义桌面功能,按你的需求进行系统设置。...

    Principles of Communication System Simulation with Wireless Aplications (英文版PDF)

    Principles of Communication System Simulation with Wireless Aplications 【作者】: William H. Tranter K. Sam Shanmugan Theodore S. Rappaport Kurt L....【页数 】:800 【出版社】 :PRENTICE HALL ...

    UNIX 高级教程系统技术内幕

    目 录 第1 章 简介(1) 1.1 简介 1.1.1 简史 1.1.2 创始之初 1.1.3 繁衍 1.1.4 BSD 1.1.5 System V 1.1.6 商业化 1.1.7 Mach 1.1.8 标准 1.1.9 OSF 和UI 1.1.10 SVR4 及其之后 ...2.2 模式....16.6.1 buf ...

    Visual C++ 数据库系统开发完全手册.part2

    17.10.1 技术总结 17.10.2 经验总结 第18章 Visual C++ 6.0在仓库管理系统中的应用 18.1 仓库管理系统概述 18.1.1 开发背景及意义 18.1.2 系统目标 18.2 系统分析 18.2.1 系统规划 18.2.2 系统结构图 18.2.3 业务...

    Visual C++ 数据库系统开发完全手册.part1

    17.10.1 技术总结 17.10.2 经验总结 第18章 Visual C++ 6.0在仓库管理系统中的应用 18.1 仓库管理系统概述 18.1.1 开发背景及意义 18.1.2 系统目标 18.2 系统分析 18.2.1 系统规划 18.2.2 系统结构图 18.2.3 业务...

    spring.net中文手册在线版

    17.10.1. ExecuteNonQuery 17.10.2. ExecuteScalar 17.11. Queries and Lightweight Object Mapping 17.11.1. ResultSetExtractor 17.11.2. RowCallback 17.11.3. RowMapper 17.11.4. Query for a single object ...

    Spring攻略(第二版 中文高清版).part2

    本书共分为两卷。 第1章 Spring简介 1 1.1 实例化Spring IoC容器 1 1.1.1 问题 1 1.1.2 解决方案 1 1.1.3 工作原理 3 1.2 配置Spring IoC容器中的Bean 4 1.2.1 问题 4 1.2.2 解决方案 4 ...

    Spring攻略(第二版 中文高清版).part1

    本书共分为两卷。 第1章 Spring简介 1 1.1 实例化Spring IoC容器 1 1.1.1 问题 1 1.1.2 解决方案 1 1.1.3 工作原理 3 1.2 配置Spring IoC容器中的Bean 4 1.2.1 问题 4 1.2.2 解决方案 4 ...

    PB开发基础教程DOCX版

    第 1 章 Hello World...........................................................................................................................1 1.1 创建 WorkSpace........................................

Global site tag (gtag.js) - Google Analytics