CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2019
    Posts
    8

    Why is my class showing up as a absract class

    Hi

    I'm trying to figure out why my class is showing up as an abstract class.

    Code:
    #include <stdio.h>
    #include "Message.hpp"
    #include "Message.hpp"
    #include "BaseEntity.hpp"
    #include "Entity.hpp"
    class SceneGraphNode;
    class Message;
    class Entity;
    
    
    /*
     Entities can be swapped with other entities. This is the base entity
     
     
     */
    
    class Entity : BaseEntity
    {
    public:
        void dispatch(Message msg);     //see message manager for instructions
                                        //class entity is the foundation of messenger
                                        //dispatch processes in the Finite State Machine
        void notify();                     //notifies the dynamic BSP that a change occurred to
                                            //the mesh and it has to rebalance
        //in this case you can use FLINCH in place of the plain vanilla finite state machine
        
        int owner_index;            //identity for message
        
        //entity is generated
        
        //factory returns an entity type
        //entity type is assigned to Message
        
        
        
    };
    
    
    
    
    
    #endif /* Entity_hpp */

    Code:
    class BaseEntity 
    {
    public:
        void dispatch(Message *msg);   //see message manager for instructions
                                         //class entity is the foundation of messenger
                                         //dispatch processes in the Finite State Machine
         void notify();                     //notifies the dynamic BSP that a change occurred to
                                             //the mesh and it has to rebalance
         //in this case you can use FLINCH in place of the plain vanilla finite state machine
         
         int owner_index;            //identity for message
         
    };

  2. #2
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: Why is my class showing up as a absract class

    Neither BaseEntity nor Entity are abstract classes since they don't have any pure virtual member functions (or even any virtual member functions, for that matter).

    What I'm curious about is whether you really intend private inheritance here (plausible since BaseEntity doesn't have a virtual destructor so maybe you're really only looking to inherit implementation). If that was a typo and you wanted public inheritance instead, then perhaps BaseEntity should have a virtual destructor and maybe the member functions that look duplicated in Entity should be virtual or even pure virtual.

    Note that Entity's dispatch has a different parameter type from BaseEntity's dispatch though (Message vs Message*).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured