인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

Inflearn Community Q&A

rcasio's profile image
rcasio

asked

[MMORPG Game Development Series with C++ and Unreal] Part 1: Introduction to C++ Programming

Function object

bool ret1 = functor(3); 이게 이해가 안갑니다

Written on

·

177

0

bool operator()(int num)

    {

        cout << "Functor Test" << endl;

        _value += num;

        cout << _value << endl;

        return true;

    }

이걸 사용한다면

bool ret1 = functor()3; 이거 아닌가요?

예를 들면

void operator+(int num)

   {

      _value += num;

        cout <<  _value << endl;

    }

이걸 쓴다면

functor + 3; 처럼요

C++

Answer 1

0

rookiss님의 프로필 이미지
rookiss
Instructor

operator[], operator() 등은 [3] (2)와 같이 안에다가 인자를 넣어줘야 합니다.
문법이 그냥 그렇게 되어 있기 때문에 가볍게 넘어가셔도 무방합니다.

rcasio's profile image
rcasio

asked

Ask a question