following is my header file
#ifndef _ASYNCHRONOUSCLASS_H
#define _ASYNCHRONOUSCLASS_H
#include "stdafx.h"
#include <windows.h>
typedef int (*functionCall)(void *);
typedef void * voidPtr;
class AsynchronousFunction{
//int returnVal;
//functionCall fCall;
//voidPtr param;
//HANDLE m_hEvent;
struct pImpl;
pImpl* m_pImpl;
public:
AsynchronousFunction(functionCall fCall, voidPtr param);
~AsynchronousFunction();
void functionExecuter();
int result();
protected:
private:
};
#endif
In the cpp file I want to implement the struct which contains following details.
*//int returnVal;*
*//functionCall fCall;*
*//voidPtr param;*
*//HANDLE m_hEvent;*
How can I implement this ? What would be suitable, forward declaration or pointer implementation ?
In a single translation unit you will need to provide the definition of the type. It will look like:
struct AsynchronousFunction::Impl {
// members and functions...
};
Note that I renamed pImpl
into Impl
, the p
in the idiom is for pointer, the member in the containing class would be Impl* pImpl;
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.