강의

멘토링

로드맵

profile image

초록

@ileum378986

수강생

-

수강평

-

강의 평점

-

kej_cute.png.webp
#include <iostream>
#include <memory>
#include <stdio.h>

#define MAKECLASS(NAME) struct NAME
#define MAKEVAR(NAME) m_##NAME
#define GETVAR(NAME) m_##NAME
#define PRI private:
#define PUB public:
MAKECLASS(Mother){
PRI
    int MAKEVAR(you);
    int MAKEVAR(dirty);
PUB
    Mother():
        GETVAR(you)(0),
        GETVAR(dirty)(1010000)
        { puts("Init"); }
    ~Mother(){ puts("Die"); }
    void Something(){ printf("%d", GETVAR(you)+GETVAR(dirty)); }
};

int main(int argc, char* argv[]){
    {
        auto mother= std::make_unique<Mother>();
        mother->Something();
    }
    return 0;
}