Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. What is reason behind getting error of "object of abstract class type is not allowed" ?
Forum Updated to NodeBB v4.3 + New Features

What is reason behind getting error of "object of abstract class type is not allowed" ?

Scheduled Pinned Locked Moved Solved C++ Gurus
3 Posts 2 Posters 2.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    Qt embedded developer
    wrote on 10 Jun 2022, 09:29 last edited by
    #1

    When i am running the code at that time i am getting below error :

    object of abstract class type "app::transaction::flow::CustomBootFlow" is not allowed

    I want to know how to resolve it ?

    #include "FlowFactory.h"
    #include "Transactions.h"
    #include "flows/Flows.h"
    
    namespace app
    {
    
    FlowFactory::FlowFactory()
    {
    	appTransactionDefinition = new app::transaction::Transactions() ;
    }
    
    FlowFactory::~FlowFactory()
    {
    	if (appTransactionDefinition!=NULL)
    		delete appTransactionDefinition ;
    }
    
    boomer::transaction::flow::BaseFlow *FlowFactory::createFlowForTransactionType(const boomer::transaction::Transaction &tr)
    {
    	if ((app::transaction::Transactions *)appTransactionDefinition->isBootTransaction(tr.id))
    		return new app::transaction::flow::CustomBootFlow();
    
    	return NULL;
    }
    }
    
    J 1 Reply Last reply 10 Jun 2022, 09:34
    0
    • Q Offline
      Q Offline
      Qt embedded developer
      wrote on 20 Jun 2022, 11:31 last edited by
      #3

      @Qt-embedded-developer said in What is reason behind getting error of "object of abstract class type is not allowed" ?:

      boomer::transaction::flow::BaseFlow *FlowFactory::createFlowForTransactionType(const boomer::transaction::Transaction &tr)

      there are i have done 2 changes in 2 file:

      1] flowfactory.h

      public:
      virtual boomer::transaction::flow::BaseFlow *createFlowForTransactionType(const boomer::transaction::Transaction &tr) ;

      2] CustomBootFlow.h

      protected:
      virtual void ConfigureOOB();
      virtual boomer::transaction::TransactionResult InitializeEMVCTConfiguration();
      virtual boomer::transaction::TransactionResult InitializeEMVCTLSConfiguration();

      1 Reply Last reply
      0
      • Q Qt embedded developer
        10 Jun 2022, 09:29

        When i am running the code at that time i am getting below error :

        object of abstract class type "app::transaction::flow::CustomBootFlow" is not allowed

        I want to know how to resolve it ?

        #include "FlowFactory.h"
        #include "Transactions.h"
        #include "flows/Flows.h"
        
        namespace app
        {
        
        FlowFactory::FlowFactory()
        {
        	appTransactionDefinition = new app::transaction::Transactions() ;
        }
        
        FlowFactory::~FlowFactory()
        {
        	if (appTransactionDefinition!=NULL)
        		delete appTransactionDefinition ;
        }
        
        boomer::transaction::flow::BaseFlow *FlowFactory::createFlowForTransactionType(const boomer::transaction::Transaction &tr)
        {
        	if ((app::transaction::Transactions *)appTransactionDefinition->isBootTransaction(tr.id))
        		return new app::transaction::flow::CustomBootFlow();
        
        	return NULL;
        }
        }
        
        J Offline
        J Offline
        JonB
        wrote on 10 Jun 2022, 09:34 last edited by JonB 6 Oct 2022, 09:40
        #2

        @Qt-embedded-developer
        So it tells you app::transaction::flow::CustomBootFlow is an abstract class. Meaning you cannot instantiate directly from it (does your new app::transaction::Transactions() return a app::transaction::flow::CustomBootFlow?), it is designed for you to need to subclass from it, implement whatever pure virtual methods it has, and off you go.

        If you still don't understand Google for C++ abstract class.

        1 Reply Last reply
        3
        • Q Offline
          Q Offline
          Qt embedded developer
          wrote on 20 Jun 2022, 11:31 last edited by
          #3

          @Qt-embedded-developer said in What is reason behind getting error of "object of abstract class type is not allowed" ?:

          boomer::transaction::flow::BaseFlow *FlowFactory::createFlowForTransactionType(const boomer::transaction::Transaction &tr)

          there are i have done 2 changes in 2 file:

          1] flowfactory.h

          public:
          virtual boomer::transaction::flow::BaseFlow *createFlowForTransactionType(const boomer::transaction::Transaction &tr) ;

          2] CustomBootFlow.h

          protected:
          virtual void ConfigureOOB();
          virtual boomer::transaction::TransactionResult InitializeEMVCTConfiguration();
          virtual boomer::transaction::TransactionResult InitializeEMVCTLSConfiguration();

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved