C ++用户定义的类交互 [英] C++ user defined classes interaction

查看:102
本文介绍了C ++用户定义的类交互的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,不确定它是否是一个正确的论坛发布

I have a question, not sure if it a correct forum to post

我有4个班级,家长班和子班级

I have 4 classes, Parent class and child classes

A类

{

int ProductType;

int ProductType;

onEvent(EventType e);

onEvent(EventType e);

}

B类:公开A

{

}

C类:公开A

{

}

D类:公开A

{

}

问题:

1。用户使用不同的产品类型创建B,C,D实例。(例如产品类型1 - > BObj1,CObj1,DObj1,产品类型2 - > BObj2,CObj2,DObj2)

1. User creates B,C,D instances with different product types.(ex- productType 1 -> BObj1, CObj1, DObj1, ProductType 2 -> BObj2, CObj2, DObj2)

相同的产品类型,OnEvent(eventType)只能执行一次。

For the same product types, OnEvent(eventType) has to be executed only once.

我如何实现它?

推荐答案

我不明白这个问题。  OnEvent成员函数将在您自己的代码调用它时多次调用。
I don't understand the question.  The OnEvent member function will be called as many times as your own code invokes it.


这篇关于C ++用户定义的类交互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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