#include <stdlib.h>
#include <stdio.h>

class B
{
    public:
        B(int b) : m_b(b) {}
        operator int()
        {
            return m_b;
        }

        int operator()()
        {
            return m_b*2;
        }

    private:
        int m_b;
};

class A
{
    public:
        A(int i)
        {
            printf("Output is: %d\n", i);
        }
};

int main()
{
    int k = 6;
    A a( B(k) );

    // what is the output of this program?

    return 0;
}

Back to top
c_brain_teasers.txt · Last modified: 2015/10/05 16:07 by Jan Stancek
Sitemap Search: