I want to use another class object in my class thread.
How can I implement it?
My implementation:
.h file
#pragma once
#include "class_A.h'
#include "class_B.h"
class MyClass
{
public:
MyClass();
~MyClass();
public:
static DWORD WINAPI _thread_use_another_class_object_(LPVOID lPvoid);
}
.cpp file
DWORD WINAPI MyClass::_thread_use_another_class_object(LPVOID lPvoid)
{
DWORD dwCurrentTime = GetTickCount();
class_A *ca = new class_A; // I want to use class_A on here.
ca->bell_action(dwCurrentTime);
delete ca;
class_B *cb = new class_B;
cb->bell_action(dwCurrentTime);
delete cb;
}
class_A.h
class class_A
{
public:
class_A();
~class_A();
public:
DWORD bell_action(DWORD type);
DWORD make_sound(DWORD type);
};
class_A.cpp
DWORD class_A::bell_action(DWORD type)
{
DWORD sound_wave = type % 670;
make_sound(sound_wave);
return 0;
}
class_B is the same as class_A
It seems like too simple and easy to understand. But I cannot compile it, cause of link error.
I am using VisualStudio 2010 SP1 on Windows 10 RS5 x64
MyClass.obj : error LNK2019 : unresolved external symbol "public: __thiscall class_A::class_A(void)" ..........