这是错的,对吧? [英] This is wrong, right?

查看:54
本文介绍了这是错的,对吧?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

示例代码的讨论,以及示例代码是相互的

以下是不一致的不是吗?


< quote>
http://publib.boulder.ibm.com/infoce...ame_hiding.htm

名称隐藏(仅限C ++)


如果类名或枚举名在范围内而未隐藏,则显示为

。类名称或枚举名称可以通过同名的显式

声明隐藏 - 作为对象,函数或枚举器 -
嵌套声明性区域中的
或派生类。只要对象,函数或枚举器

名称可见,类名称或

枚举名称就会被隐藏。这个过程被称为名称隐藏。


在成员函数定义中,本地名称的声明隐藏了该类成员的

声明同名。派生类中

a成员的声明隐藏了基础

类同名成员的声明。


假设名称x是命名空间A的成员,并且假设由于使用声明,名称空间A中的成员名称为/ b $ b $命名空间。名称空间B中名为x的对象的
声明将隐藏A :: x。

以下示例演示了这一点:


#include< iostream>

#include< typeinfo>

使用命名空间std;


命名空间A {

char x;

};


命名空间B {

使用命名空间A;

int x;

};


int main(){

cout<< typeid(B :: x).name()<<结束;

}


以下是上例的输出:


int


命名空间B中的整数x的声明隐藏了使用声明引入的字符x



< / quote>


如果有人知道如何联系文档的维护者,你可以

想让他们知道。

-

NOUN:1。遗嘱遗留给他人的金钱或财产。 2.从祖先或前任或过去那里下来的东西:b
宗教自由的遗产。 ETYMOLOGY:MidE legacie,副手办公室,来自OF,来自ML legatia的
,来自L legare,以及deute,遗赠。 www.bartleby.com/61/

The discussion of the example code, and the example code are mutually
inconsistent in the following are they not?

<quote>
http://publib.boulder.ibm.com/infoce...ame_hiding.htm
Name hiding (C++ only)

If a class name or enumeration name is in scope and not hidden, it is
visible. A class name or enumeration name can be hidden by an explicit
declaration of that same name -- as an object, function, or enumerator --
in a nested declarative region or derived class. The class name or
enumeration name is hidden wherever the object, function, or enumerator
name is visible. This process is referred to as name hiding.

In a member function definition, the declaration of a local name hides the
declaration of a member of the class with the same name. The declaration of
a member in a derived class hides the declaration of a member of a base
class of the same name.

Suppose a name x is a member of namespace A, and suppose that the members of
namespace A are visible in a namespace B because of a using declaration. A
declaration of an object named x in namespace B will hide A::x. The
following example demonstrates this:

#include <iostream>
#include <typeinfo>
using namespace std;

namespace A {
char x;
};

namespace B {
using namespace A;
int x;
};

int main() {
cout << typeid(B::x).name() << endl;
}

The following is the output of the above example:

int

The declaration of the integer x in namespace B hides the character x
introduced by the using declaration.
</quote>

If anybody knows how to contact the maintainers of the document, you may
want to let them know.
--
NOUN:1. Money or property bequeathed to another by will. 2. Something handed
down from an ancestor or a predecessor or from the past: a legacy of
religious freedom. ETYMOLOGY: MidE legacie, office of a deputy, from OF,
from ML legatia, from L legare, to depute, bequeath. www.bartleby.com/61/

推荐答案

Steven T. Hatton写道:
Steven T. Hatton wrote:

对示例代码的讨论和示例代码是相互的

以下不一致是不是?


< quote>
http://publib.boulder.ibm。 com / infoce ... ame_hiding.htm

名称隐藏(仅限C ++)


如果类名或枚举名在范围内且没有隐藏,它是可见的b $ b。类名称或枚举名称可以通过同名的显式

声明隐藏 - 作为对象,函数或枚举器 -
嵌套声明性区域中的
或派生类。只要对象,函数或枚举器

名称可见,类名称或

枚举名称就会被隐藏。这个过程被称为名称隐藏。


在成员函数定义中,本地名称的声明隐藏了该类成员的

声明同名。派生类中

a成员的声明隐藏了基础

类同名成员的声明。


假设名称x是命名空间A的成员,并且假设由于使用声明,名称空间A中的成员名称为/ b $ b $命名空间。名称空间B中名为x的对象的
声明将隐藏A :: x。

以下示例演示了这一点:


#include< iostream>

#include< typeinfo>

使用命名空间std;


命名空间A {

char x;

};


命名空间B {

使用命名空间A;

int x;

};


int main(){

cout<< typeid(B :: x).name()<<结束;

}


以下是上例的输出:


int


命名空间B中的整数x的声明隐藏了使用声明引入的字符x



< / quote>


如果有人知道如何联系文档的维护者,你可能会想要让他们知道。
The discussion of the example code, and the example code are mutually
inconsistent in the following are they not?

<quote>
http://publib.boulder.ibm.com/infoce...ame_hiding.htm
Name hiding (C++ only)

If a class name or enumeration name is in scope and not hidden, it is
visible. A class name or enumeration name can be hidden by an explicit
declaration of that same name -- as an object, function, or enumerator --
in a nested declarative region or derived class. The class name or
enumeration name is hidden wherever the object, function, or enumerator
name is visible. This process is referred to as name hiding.

In a member function definition, the declaration of a local name hides the
declaration of a member of the class with the same name. The declaration of
a member in a derived class hides the declaration of a member of a base
class of the same name.

Suppose a name x is a member of namespace A, and suppose that the members of
namespace A are visible in a namespace B because of a using declaration. A
declaration of an object named x in namespace B will hide A::x. The
following example demonstrates this:

#include <iostream>
#include <typeinfo>
using namespace std;

namespace A {
char x;
};

namespace B {
using namespace A;
int x;
};

int main() {
cout << typeid(B::x).name() << endl;
}

The following is the output of the above example:

int

The declaration of the integer x in namespace B hides the character x
introduced by the using declaration.
</quote>

If anybody knows how to contact the maintainers of the document, you may
want to let them know.



所以需要做的就是告诉维护者你认为

上面的文字有错误吗?特别是对于他们或其他人来说,它没有用 -

- 知道你认为错误是什么?


格雷格

So all that needs to be done is to tell the maintainers that you think
there is a mistake in the above text? In particular it''s not useful -
for them or for anyone else - to know what you think the mistake is?

Greg


Greg写道:
Greg wrote:

Steven T. Hatton写道:
Steven T. Hatton wrote:

>示例代码的讨论和示例代码在以下是相互不一致的,不是吗?

< quote>
>The discussion of the example code, and the example code are mutually
inconsistent in the following are they not?

<quote>

http://publib.boulder.ibm.com/infoce...ame_hiding.htm


>名称隐藏(仅限C ++)

如果类名称或枚举名称在范围内而未隐藏,则它是可见的。类名或枚举名可以通过在嵌套声明性区域或派生类中使用相同名称的显式
声明(作为对象,函数或枚举器)来隐藏。只要对象,函数或枚举器名称可见,就会隐藏类名或
枚举名。此过程称为名称隐藏。

在成员函数定义中,本地名称的声明隐藏了具有相同名称的类成员的声明。派生类中成员的
声明隐藏了同名基类成员的声明。

假设名称x是命名空间A的成员并且假设命名空间A的成员在命名空间B中是可见的,因为使用了
声明。名称空间B中名为x的对象的声明将隐藏
A :: x。以下示例演示了这一点:

#include< iostream>
#include< typeinfo>
使用命名空间std;

命名空间A {
char x;
};

命名空间B {
使用命名空间A;
int x;
};

int main(){
cout<< typeid(B :: x).name()<< endl;
}

以下是上例的输出:




在命名空间中声明整数x B隐藏使用声明引入的字符x
< / quote>

如果有人知道如何联系文档的维护者,你可以
想让他们知道。
>Name hiding (C++ only)

If a class name or enumeration name is in scope and not hidden, it is
visible. A class name or enumeration name can be hidden by an explicit
declaration of that same name -- as an object, function, or enumerator --
in a nested declarative region or derived class. The class name or
enumeration name is hidden wherever the object, function, or enumerator
name is visible. This process is referred to as name hiding.

In a member function definition, the declaration of a local name hides
the declaration of a member of the class with the same name. The
declaration of a member in a derived class hides the declaration of a
member of a base class of the same name.

Suppose a name x is a member of namespace A, and suppose that the members
of namespace A are visible in a namespace B because of a using
declaration. A declaration of an object named x in namespace B will hide
A::x. The following example demonstrates this:

#include <iostream>
#include <typeinfo>
using namespace std;

namespace A {
char x;
};

namespace B {
using namespace A;
int x;
};

int main() {
cout << typeid(B::x).name() << endl;
}

The following is the output of the above example:

int

The declaration of the integer x in namespace B hides the character x
introduced by the using declaration.
</quote>

If anybody knows how to contact the maintainers of the document, you may
want to let them know.



所以需要做的就是告诉维护者你认为

上面的文字有错误吗?特别是它对他们或其他任何人来说都没用 -

- 知道你认为错误是什么?


Greg


So all that needs to be done is to tell the maintainers that you think
there is a mistake in the above text? In particular it''s not useful -
for them or for anyone else - to know what you think the mistake is?

Greg



也许我错了。没有错误吗?


-

NOUN:1。遗嘱遗留给他人的金钱或财产。 2.从祖先或前任或过去那里下来的东西:b
宗教自由的遗产。 ETYMOLOGY:MidE legacie,副手办公室,来自OF,来自ML legatia的
,来自L legare,以及deute,遗赠。 www.bartleby.com/61/


Steven T. Hatton写道:
Steven T. Hatton wrote:

Greg写道:
Greg wrote:

> Steven T. Hatton写道:
>Steven T. Hatton wrote:

>>示例代码的讨论,以及示例代码相互之间不一致,以下是不是?

< quote>
>>The discussion of the example code, and the example code are mutually
inconsistent in the following are they not?

<quote>

http://publib.boulder.ibm.com/infoce .. .ame_hiding.htm


>>名称隐藏(仅限C ++)

如果类名或枚举名在范围内而未隐藏,则可见。类名或枚举名可以通过与嵌套声明性区域或派生类相同名称的显式
声明(作为对象,函数或枚举器)隐藏。只要对象,函数或枚举器名称可见,就会隐藏类名或
枚举名。此过程称为名称隐藏。

在成员函数定义中,本地名称的声明隐藏了具有相同名称的类成员的声明。派生类中成员的
声明隐藏了同名基类成员的声明。

假设名称x是命名空间A的成员并且假设命名空间A的成员在命名空间B中是可见的,因为使用了
声明。名称空间B中名为x的对象的声明将隐藏
A :: x。以下示例演示了这一点:

#include< iostream>
#include< typeinfo>
使用命名空间std;

命名空间A {
char x;
};

命名空间B {
使用命名空间A;
int x;
};

int main(){
cout<< typeid(B :: x).name()<< endl;
}

以下是上例的输出:




在命名空间中声明整数x B隐藏使用声明引入的字符x
< / quote>

如果有人知道如何联系文档的维护者,你可以
想让他们知道。
>>Name hiding (C++ only)

If a class name or enumeration name is in scope and not hidden, it is
visible. A class name or enumeration name can be hidden by an explicit
declaration of that same name -- as an object, function, or enumerator
-- in a nested declarative region or derived class. The class name or
enumeration name is hidden wherever the object, function, or enumerator
name is visible. This process is referred to as name hiding.

In a member function definition, the declaration of a local name hides
the declaration of a member of the class with the same name. The
declaration of a member in a derived class hides the declaration of a
member of a base class of the same name.

Suppose a name x is a member of namespace A, and suppose that the
members of namespace A are visible in a namespace B because of a using
declaration. A declaration of an object named x in namespace B will hide
A::x. The following example demonstrates this:

#include <iostream>
#include <typeinfo>
using namespace std;

namespace A {
char x;
};

namespace B {
using namespace A;
int x;
};

int main() {
cout << typeid(B::x).name() << endl;
}

The following is the output of the above example:

int

The declaration of the integer x in namespace B hides the character x
introduced by the using declaration.
</quote>

If anybody knows how to contact the maintainers of the document, you may
want to let them know.


所有需要做的就是告诉维护者你认为上述文本中有错误吗?特别是它对于他们或其他任何人都没用 - 知道你认为错误是什么吗?

Greg


So all that needs to be done is to tell the maintainers that you think
there is a mistake in the above text? In particular it''s not useful -
for them or for anyone else - to know what you think the mistake is?

Greg



也许我错了。没有错误吗?


Perhaps I am mistaken. Is there no error?



这是一个测验吗? _you_认为什么是假的。请更具体一点;然后

你可能会得到更好的答案。

最好


Kai-Uwe Bux

Is this a quiz? What do _you_ think is false. Please, be more specific; then
you might get better answers.
Best

Kai-Uwe Bux


这篇关于这是错的,对吧?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆