(C ++)++的新关键字 [英] new keywords for (C++)++

查看:80
本文介绍了(C ++)++的新关键字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当有人想到新版本的C ++时,如何包括

这些:


------------ -----------

typeof:

class A

{

public:

void foo();

} a;


typefo(a)b;

b.foo();


-----------------------

typeofbase :


A级

{

公开:

foo();

};


B级:公共A

{

foo(){typeofbase :: foo() ;} //调用:A :: foo();

};


-

- Gernot

int main(int argc,char ** argv){printf

("%silto%c%cf%cgl%ssic%ccom%c"," ; ma",58,''g'',64," ba",46,10);}

When someone thinks about a new version of C++, how about including
these:

-----------------------
typeof:
class A
{
public:
void foo();
} a;

typefo(a) b;
b.foo();

-----------------------
typeofbase:

class A
{
public:
foo();
};

class B : public A
{
foo() {typeofbase::foo();} // calls: A::foo();
};


--
-Gernot
int main(int argc, char** argv) {printf
("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, ''g'', 64, "ba", 46, 10);}

推荐答案

15月15日2005年6月11:41:06 +0200,Gernot Frisch < Me@Privacy.net>

写道:
On Wed, 15 Jun 2005 11:41:06 +0200, "Gernot Frisch" <Me@Privacy.net>
wrote:
当有人想到新版本的C ++时,如何包括这些:
When someone thinks about a new version of C++, how about including
these:




[snip]


comp.std.c ++是提出这个问题的地方。

-

Bob Hairgrove
No **** ******@Home.com


Gernot Frisch写道:
Gernot Frisch wrote:
当有人想到新版本的C ++时如何包括这些:
When someone thinks about a new version of C++, how about including
these:




正如Bob Hairgrove所说,clc ++就是这个地方。但是建议:

而不是提出关键词,谈谈你试图解决的问题是什么?b $ b解决。语法后来出现。


-


Pete Becker

Dinkumware,Ltd。( http://www.dinkumware.com




" Gernot Frisch" < Me@Privacy.net>在消息中写道

news:3h ************ @ individual.net ...

"Gernot Frisch" <Me@Privacy.net> wrote in message
news:3h************@individual.net...
当有人想到新版本的C ++时包括这些怎么样:

-----------------------
typeof:
A类
{
公开:
void foo();
} a;

typefo(a)b;
b.foo();

-----------------------
typeofbase:

A类 {
public:
foo();
};

B类:公开A
{
foo(){typeofbase: :foo();} //调用:A :: foo();
};


-Gernot
int main( int argc,char ** argv){printf
When someone thinks about a new version of C++, how about including these:

-----------------------
typeof:
class A
{
public:
void foo();
} a;

typefo(a) b;
b.foo();

-----------------------
typeofbase:

class A
{
public:
foo();
};

class B : public A
{
foo() {typeofbase::foo();} // calls: A::foo();
};


--
-Gernot
int main(int argc, char** argv) {printf




你为什么需要那个?你不能只看看你想要的类型吗?它看起来像你要节省的只是你需要付出一些努力才能知道你在做什么。这并不像你突然想要一个新类型的b因为你是改变a的类型,或者你的基类只是改变了一些类型

点。这些变化通常会涉及你如何使用这些物品,而不仅仅是他们的类型。你有解决的现实问题吗?


-Howard



Why would you need that? Can''t you just look and see the type you want? It
looks like all you''re saving is some effort on your part to know what you''re
doing. It''s not like you suddenly want a new type for b because you''re
changing the type of a, or that your base class simply changes at some
point. Such changes would generally involve how you use the objects, not
just their type. Do you have a real-world problem that this solves?

-Howard


这篇关于(C ++)++的新关键字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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