如何实现一个简单的类forname? [英] how to implement a simple class forname?

查看:66
本文介绍了如何实现一个简单的类forname?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我需要实现一些类成员函数的映射。

这个映射由一个字符串和一个指向该成员的指针组成功能。


问题是地图需要保存的对象是相同的

类型。

那么什么类型的在地图的声明中指定?


map< std :: string,void * ??


PD:请原谅我的不好英语

Hi,

I need implement a map of member functions of some class.
This map is formed by a string and a pointer to the member function.

The problem is that the map need that the object saved are the same
type.
So what type to specify in the declaration of the map?

map<std::string,void *??

PD: excuse me for my bad english

推荐答案

Manuel写道:
Manuel wrote:

我需要实现一张地图某些类的成员函数。

此映射由字符串和指向成员函数的指针组成。
I need implement a map of member functions of some class.
This map is formed by a string and a pointer to the member function.



什么类的成员?它需要什么参数?什么类型

它返回?

Member of what class? What arguments does it take? What type does
it return?


问题是地图需要保存的对象是相同的

类型。
The problem is that the map need that the object saved are the same
type.



正确。

Right.


那么在地图声明中指定什么类型?
So what type to specify in the declaration of the map?



您打算在地图中存储的对象的类型。

The type of the objects you intend to store in the map.


map< std :: string,void * ??
map<std::string,void *??



V

-

请在通过电子邮件回复时删除资金'A'

我没有回复最热门的回复,请不要问

V
--
Please remove capital ''A''s when replying by e-mail
I do not respond to top-posted replies, please don''t ask


Victor Bazarov写道:
Victor Bazarov wrote:

Manuel写道:
Manuel wrote:

我需要实现某类成员函数的地图。

此地图由字符串和指向成员函数的指针组成。
I need implement a map of member functions of some class.
This map is formed by a string and a pointer to the member function.



什么类的成员?它需要什么参数?什么类型

它返回?


Member of what class? What arguments does it take? What type does
it return?



成员来自不同类,派生出一个超类,这个

成员做

不返回任何东西。

The members are of different class that derive of a superclass and this
members do
not return anything.


>
>

问题是地图需要保存的对象是相同的

类型。
The problem is that the map need that the object saved are the same
type.



正确。


Right.


那么在地图声明中指定什么类型?
So what type to specify in the declaration of the map?



您打算存储在地图中的对象类型。


The type of the objects you intend to store in the map.


map< std :: string,void * ??
map<std::string,void *??



V

-

请在通过电子邮件回复时删除资金'A'

我不回复热门回复,请不要问


V
--
Please remove capital ''A''s when replying by e-mail
I do not respond to top-posted replies, please don''t ask



感谢您的快速回复

Thanks for your fast reply


Manuel写道:
Manuel wrote:

Victor Bazarov写道:
Victor Bazarov wrote:

> Manuel写道:
>Manuel wrote:

>>我需要实现一些类的成员函数的地图。
这张地图是由一个string和指向成员函数的指针。
>>I need implement a map of member functions of some class.
This map is formed by a string and a pointer to the member function.


什么类的成员?它需要什么参数?它会返回什么类型?


Member of what class? What arguments does it take? What type does
it return?



成员来自不同类,派生一个超类和

这个成员做什么

不返回任何东西。


The members are of different class that derive of a superclass and
this members do
not return anything.



在同一个容器中存储不同类的成员函数是什么意思?
?关于这些功能的_common_是什么?如何使用这些地图元素



如果他们没有返回任何内容,返回值类型为''void'' 。


V

-

请在通过电子邮件回复时删除资金'A'

我没有回复最热门的回复,请不要问

What''s the point to have member functions of different classes stored
in the same container? What''s _common_ about those functions? How
do you intend to use those map elements?

And if they don''t return anything, the return value type is ''void''.

V
--
Please remove capital ''A''s when replying by e-mail
I do not respond to top-posted replies, please don''t ask


这篇关于如何实现一个简单的类forname?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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