[英]Object has type qualifiers that are not compatible with the member function
[英]the object has type qualifiers that are not compatible with the member function sfml overriding draw
我正在使用SFML 2.1,并且想覆盖drawable :: draw方法:
void AnimatedSprite::draw(sf::RenderTarget& target, sf::RenderStates states) const;
在其实现中,我正在使用具有以下签名的成员函数:(导致标题错误的函数)
const sf::Sprite AnimatedSprite::getCurrent()
在此函数中,我使用另一个具有相似签名的函数:
const sf::Sprite Animation::getCurrent()
我返回一个非常量Sprite。
我想可能是问题所在,但是为什么呢? 我不能使用非常量变量来绘制我的实体吗? 如果可以的话,怎么办?
您是否忘记在getCurrent函数上添加const? 另外,您还返回了Sprite的副本,这是您想要的吗? 尝试const sf::Sprite& AnimatedSprite::getCurrent() const
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.