Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1049833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:40:41+00:00 2026-05-16T16:40:41+00:00

I created a class which holds data of type and returns an vector on

  • 0

I created a class which holds data of type and returns an vector on request.
But somehow the following error occurs:

error C2259: 'CAcceptor' : cannot instantiate abstract class
          due to following members:
          'void CDataAndEvent<C>::InitQueue(void)' : is abstract
          with
          [
              C=SOCKET
          ]
          see declaration of 'CDataAndEvent<C>::InitQueue'         with
          [              C=SOCKET
           ]

code for the class:

#pragma once
#include <IncStandard.h>
#include <IncWinsock.h>
#include <IncStatus.h>

//Class which hold an Input and Output vector
//and the corresponding events
template<class C>
class CDataAndEvent
{
public:
 CDataAndEvent(void);
 virtual ~CDataAndEvent(void);

 //Access functions
 //Vectors
 virtual Inc::STATS GetInData(__out std::vector<C>&);
 virtual Inc::STATS GetOutData(__out std::vector<C>&);
 virtual Inc::STATS AddDataIn(__in const C&);
 virtual Inc::STATS AddDataOut(__in const C&);
 //Queues
 virtual HANDLE GetOutEvent() { return m_hEventOut; };
 virtual HANDLE GetInEvent() { return m_hEventIn; };

protected:
 //Make this class non-instanceable
 virtual void InitQueue() = 0;

private:
 //Input-/Output Vector
 std::vector<C> m_vecIn;
 std::vector<C> m_vecOut;

 //Events for the input- and output vector
 HANDLE m_hEventIn;
 HANDLE m_hEventOut;

 //Indicators
 bool m_bNewIn;
 bool m_bNewOut;
};

template<class C>
CDataAndEvent<C>::CDataAndEvent(void) : m_bNewIn(false), m_bNewOut(false)
{
 //create events
 m_hEventIn = CreateEvent(NULL, TRUE, FALSE, NULL);
 m_hEventOut = CreateEvent(NULL, TRUE, FALSE, NULL);
}

template<class C>
CDataAndEvent<C>::~CDataAndEvent(void)
{
}

template<class C>
Inc::STATS CDataAndEvent<C>::GetOutData(std::vector<C>& vec)
{
 if(!m_bNewOut)
  return Inc::NEMPTY;

 vec = m_vecOut;
 m_vecOut.clear();

 m_bNewOut = false;
 ResetEvent(m_hEventOut);

 return Inc::SOK;
}

template<class C>
Inc::STATS CDataAndEvent<C>::GetInData(std::vector<C>& vec)
{
 if(!m_bNewIn)
  return Inc::NEMPTY;

 //copy
 vec = m_vecIn;

 //clear the read data
 m_vecIn.clear();

 //no new data
 ResetEvent(m_hEventIn);
 m_bNewIn = false;

 return Inc::SOK;
}

template<class C>
Inc::STATS CDataAndEvent<C>::AddDataOut(const C& str)
{
 m_vecOut.push_back(str);

 m_bNewOut = true;

 SetEvent(m_hEventOut);

 return Inc::SOK;
}

template<class C>
Inc::STATS CDataAndEvent<C>::AddDataIn(const C& str)
{
 m_vecIn.push_back(str);

 //new data available
 m_bNewIn = true;
 SetEvent(m_hEventIn);

 return Inc::SOK;
}

Anyone got a clue why this happens?…

The CAcceptor-class is defined as the following

#pragma once
#include "connection.h"
#include "DataAndEvent.h"
class CAcceptor :
 public CConnection, public CDataAndEvent<SOCKET>
{
public:
 CAcceptor(void);
 virtual ~CAcceptor(void);

 //Bind the port
 Inc::STATS BindSocket(const std::string& strPort);

 Inc::STATS Start();  //Start accepting
 Inc::STATS Stop();  //Stop accepting

private:
 //Send data: not needed for the acceptor
 Inc::STATS _SendData(sockaddr* pTarget, int tolen, std::string& strData) {return Inc::EUNKNOWN;};
 //Recv data: not needed for the acceptor
 Inc::STATS _RecvData(sockaddr* pSender, int* tolen, std::string& strData) {return Inc::EUNKNOWN;};

 //Create sockets
 Inc::STATS CreateSocket();
 //Delete Sockets
 Inc::STATS DeleteSocket();

 //Thread stuff
 HANDLE m_hThread;  //Thread handle for the auto mode thread
 friend DWORD WINAPI AutoModeThread(void*);  //Auto mode thread
};

and as far as i checked it overrides the pure virtual functions from CConnection:

#pragma once

//Headers
#include <IncStatus.h>
#include <IncWinsock.h>
#include <IncStandard.h>

class CConnection
{
public:
 CConnection();
 virtual ~CConnection(void);

 //TEST: Bind socket contained by m_mapSocketContainer
 virtual Inc::STATS BindSocket(const std::string& strPort) = 0;

 //Resolve Target Address
 addrinfo* ResolveAddress(const std::string& strAddress, const std::string& strPort);

protected:
 //Sockets
 SOCKET m_Socket;

 //Target Address
 addrinfo* m_pTargetAddress;

 //Socket
 //Creates the sockets needed
 //Will be called automatically by the constructor
 virtual Inc::STATS CreateSocket() = 0;
 //closes the sockets
 //Will be called automatically by the destructor
 virtual Inc::STATS DeleteSocket() = 0;

 //Data Transmission User Request
 virtual Inc::STATS _SendData(sockaddr* pTarget, int tolen, std::string& strData) = 0;
 virtual Inc::STATS _RecvData(sockaddr* pSender, int* fromlen, std::string& strData) = 0;

private:
 //Winsock startup & cleanup
 //Start / Stop
 Inc::STATS StartWinsock();
 Inc::STATS StopWinsock();

 WSADATA m_Wsa;
 unsigned short m_wWsaVer;

 static bool bWinsockRunning;
};

Thank You!…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T16:40:42+00:00Added an answer on May 16, 2026 at 4:40 pm

    All classes derived from the class template CDataAndEvent<T> including CAcceptor needs to define InitQueue() (which is a pure virtual function making the class template an abstract one). I don’t see any CAcceptor::InitQueue definition though in the code you posted.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a class for a dashboard item which will hold information such
I have created UITableCellView class called NoteCell . The header defines the following: #import
I'm looking for a PHP library/function/class which can create Identicon s.
I have a class Page that creates an instance of DB , which is
I have created a class library in VB .NET. Some code in the library
Perhaps naively, I created a class (AdminDatabase) to handle connection to different MS-Access database
I have created a C# class file by using a XSD-file as an input.
How a user exception class is created from standard exception? Addressing below cases Say
I have a collection of classes that inherit from an abstract class I created.
For a new project that I'm doing in PHP I've created an SQLMethods class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.