强制执行函数调用的顺序?(enforce order of function calls?)
假设我有一个抽象基类,我想要一个纯粹的虚方法,它必须由派生类实现,但我想确保派生方法以特定顺序调用函数,我可以如何执行它?
IE
base class virtual void doABC()=0; virtual void A()=0; virtual void B()=0; virtual void C()=0; // must call ABC in the correct order derived class public base void doABC();
这就是为什么我更好地理解如何设计我的类来强制某人正确使用我的类。
Say I have a abstract base class and I want to have a pure virtual method which must be implemented by the derived class but I want to make sure that the derived method calls functions in a particular order what could I do to enforce it ?
I.E
base class virtual void doABC()=0; virtual void A()=0; virtual void B()=0; virtual void C()=0; // must call ABC in the correct order derived class public base void doABC();
This is just so I have a better understanding on how to design my classes to enforce someone to use my class correctly.
原文:https://stackoverflow.com/questions/10601943
满意答案
我不知道
numberp
,symbolp
,布尔类型和其他类型谓词的确切历史,但是对于泛型类型谓词typep
的可用性,没有必要对每个类型都有单独的谓词。 查看某些boolean
类型的简短方法是(typep object 'boolean)
。I don't know the exact history of
numberp
,symbolp
, the boolean type, and other type predicates, but with the availability of the generic type predicatetypep
it is not necessary to have a separate predicate for every type. A short way to see if something is of typeboolean
is(typep object 'boolean)
.
相关问答
更多什么是谓词?(What is a predicate?)
探究剩余与加入谓词(Probe Residual vs Join Predicate)
如何在谓词中使用谓词“断言”(How to use the predicate “assert” in a predicate)
如何构建用于查找的谓词?(How to build this predicate for use with Find?)
为什么没有BOOLEANP谓词?(Why isn't there a BOOLEANP predicate?)
与谓词非常相似的东西,但不是谓词(Something very similar to predicate, but not a predicate)
Łukasiewicz谓词逻辑?(Łukasiewicz predicate logic?)
谓词......还是其他一些术语?(Predicate… or some other term?)
获取调用谓词的名称(Get the name of the calling predicate)
使用DapperExtensions进行谓词化(Predicate with DapperExtensions)
相关文章
更多两种js function 声明方式
Heritrix源码分析(二) 配置文件order.xml介绍
function-Oceanus配置说明
MyBatis动态参数order by的设置
error C2668: 'M' : ambiguous call to overloaded function
Heritrix源码分析(三) 修改配置文件order.xml加快你的抓取速度
自定义路由逻辑函数-Oceanus编码调用
怎么用quartz控制任务的执行顺序
求一个group by后面字段顺序影响结果的例子
Scala函数定义与调用
最新问答
更多获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
如何通过引用返回对象?(How is returning an object by reference possible?)
矩阵如何存储在内存中?(How are matrices stored in memory?)
每个请求的Java新会话?(Java New Session For Each Request?)
css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
xcode语法颜色编码解释?(xcode syntax color coding explained?)
在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!