0

hello everone

i'm new to c++ language

Is This possible to make prg in cpp to overload () Opratore

if yes, then can u pls give any logical flow for develope the prg

i.e. which kind of opeartion can be performed through () opratore

thanx in advance

3
Contributors
5
Replies
6
Views
8 Years
Discussion Span
Last Post by Narue
0

Are you thinking about using the () as the conversion operator or talking about overloading the () operator to do something like addition or concatenation or some other theoretical possibility?

0

hi......

i have some idea that in overloading of + operatore we can

perform summation or can concate to string

so whould u pls tell me which kind of

operation should i perform for overload the

() as operatore

0

When you overload the () operator, it's used as if it were a function call operator and nothing more:

#include <iostream>

struct foo {
    void operator()()
    {
        std::cout<<"FOO!\n";
    }
};

int main()
{
    foo bar;

    bar();
}

If that's not what you want, you're SOL.

0

yes i aggre whith u but

whould u pls suggest me which kind of operation

is suitable for overloading () as operatore

0

It sounds disturbingly like you're looking for a problem to fit the solution you recently learned. That's silly.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.