Archived

This forum has been archived. Please start a new discussion on GitHub.

why struct inherit class

struct EvictorEntry : public Ice::LocalObject {
Ice::ObjectPtr servant;
Ice::LocalObjectPtr userCookie;
EvictorQueue::iterator pos;
int useCount; };

struct EvictorEntry inherit Ice::LocalObject why?

Comments

  • Can struct inherit class ?
  • marc
    marc Florida
    Re: why struct inherit class
    Originally posted by code
    struct EvictorEntry : public Ice::LocalObject {
    Ice::ObjectPtr servant;
    Ice::LocalObjectPtr userCookie;
    EvictorQueue::iterator pos;
    int useCount; };

    struct EvictorEntry inherit Ice::LocalObject why?

    Where is this from? Ice structs mapped to C++ do not inherit from anything.
  • marc
    marc Florida
    Originally posted by code
    Can struct inherit class ?

    No, Ice structs do not support inheritance. They are simple light-weight data containers. Please see the Ice manual for details.
  • on ICE-1.5.1.pdf page 496


    class EvictorBase : public Ice::ServantLocator {
    public: // ...
    private: struct EvictorEntry;
    typedef IceUtil::Handle<EvictorEntry> EvictorEntryPtr;
    typedef std::map<Ice::Identity, EvictorEntryPtr> EvictorMap;
    typedef std::list<EvictorMap::iterator> EvictorQueue;
    struct EvictorEntry : public Ice::LocalObject {
    Ice::ObjectPtr servant;
    Ice::LocalObjectPtr userCookie;
    EvictorQueue::iterator pos; int useCount;
    };
    struct EvictorCookie : public Ice::LocalObject {
    EvictorEntryPtr entry;
    };
    typedef IceUtil::Handle<EvictorCookie> EvictorCookiePtr;
    EvictorMap _map;
    EvictorQueue _queue;
    Ice::Int _size; IceUtil::Mutex _mutex;
    void evictServants();
    };
  • marc
    marc Florida
    This is C++ code, not Slice code or code generated from Slice code. In C++, structs can inherit from classes. Please see your C++ documentation for details.
  • Thanks