Salve,
volevo sapere se nella seguente classe sto implementando bene costruttori e distruttore:
codice:
// waveCapture.h
#include <windows.h>
#include <fstream>
(...)
class waveCapture
{
public:
waveCapture();
waveCapture(DWORD, DWORD, DWORD);
~waveCapture();
private:
DWORD dwA;
DWORD dwB;
DWORD dwC;
HANDLE hevent;
HWAVEIN hwi;
WAVEHDR *buff;
std::ofstream hFile;
}
// waveCapture.cpp
waveCapture::waveCapture() :
dwA(0), dwB(0), dwC(0), buff(NULL), hwi(NULL), hevent(NULL) { }
waveCapture::waveCapture(DWORD a, DWORD b, DWORD c) :
dwA(a), dwB(b), dwC(c), buff(NULL), hwi(NULL), hevent(NULL) { }
waveCapture::~waveCapture()
{
delete[] buff;
hwi = NULL;
hevent = NULL;
}
purtroppo non riesco ad inizializzare std:fstream hFile in quanto non sembra accettare ne 0 ne NULL.
inoltre volevo un consiglio su i parametri del costruttore, dato che non verranno mai modificati dalla funzione ma solo letti li posso passare come costante?
codice:
waveCapture(const DWORD, const DWORD, const DWORD);
e quindi nel costruttore:
codice:
waveCapture::waveCapture(const DWORD a, const DWORD b, const DWORD c) : (....etc...)
va bene?? avrò migliorie a livello di compilazione?? (VC++ EE)
grazie