I would like to know how to change the address of Test which is in the virtual table with that of HackedVTable.
void HackedVtable()
{
The V-Table is an implementation detail.
The compiler is not required to use one (it just happens to be the easiest way to implement virtual functions). But saying that each compiler can (and does) implement it slightly differently as a result there is no answer to your question.
If you ask how do I hack a vtable for a program built with:
Compiler
Then somebody may know the answer.