开发者

A Polymorphism Problem

it works when :

list<ItemFixed> XYZ::List()
{
        list<Ite开发者_开发问答m> items = _Browser->GetMusic();
        list<ItemFixed> retItems = _Converter->Convert (items);
        return retItems;
}

but not :

list<ItemFixed> XYZ::List()
{
        return _Converter->Convert (_Browser->GetMusic());
}

Any suggestions? thanks


Are you passing the list<Item> as non-const reference to Convert function? In that case it will not compile as you can not pass temporary object by non-const reference in C++.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜