#define W_FUNCT(retType, functName) \
retType functName() {return 123; } \
retType _##functName() {return 456;} \
#define W_FUNCT(retType, functName, ...) \
retType functName(__VA_ARGS__) {return __##functName(); } \
retType __##functName() { return 456; } \
retType _##functName();
class Class2;
class Class1 : public BaseClass
.......
#include "class1.h"
#include "class2.h"
.....
#include "class3.h"
class Class2
.....
#include "class2.h"
......
#include "class1.h"
class Class2;
class Class3 : public Class1
.....
#include "class3.h"
#include "class2.h"
SET @var1:="0"
SELECT @var1:=CONCAT(@var1, ",", lot_id) ....
select @var1
и готовчинко