////////////////////////////////////////////////////////////////////////////////
// foo.h
class Base;
void Hello(const Base* base);
void Hello(const void* drive);
////////////////////////////////////////////////////////////////////////////////
// foo.cc
#include "foo.h"
#include <stdio.h>
#include "base.h"
void Hello(const Base* base) {
printf("Hello <const Base *>");
}
void Hello(const void* ptr) {
printf("Hello <const void*>");
}
////////////////////////////////////////////////////////////////////////////////
// base.h
class Base {
public:
virtual ~Base() = default;
};
////////////////////////////////////////////////////////////////////////////////
// drive.h
#include "base.h"
class Driver : public Base {
public:
~Driver() override = default;
};
////////////////////////////////////////////////////////////////////////////////
// test.h
class D;
void Test(const D* d);
////////////////////////////////////////////////////////////////////////////////
// test.cc
#include "foo.h"
_
void Test(const D* d) {
Hello(d);
}
////////////////////////////////////////////////////////////////////////////////
// main.cc
#include "drive.h"
#include "test.h"
int main(int argc, char** argv) {
Drive d;
Test(&d);
return 0;
}