Logo Search packages:      
Sourcecode: gcc-2.96 version File versions

bug-42946.cc

#include <backward/iostream.h>
//#include <iostream>

class foo
{
public:
    foo() : a(0), b(0) {};  // default ctor
    foo(int av, int bv) : a(av), b(bv) {};
    ~foo() {};
    int getval1() { return a; };
    int getval2() { return b; };
    void print(ostream & os) { os << "(" << a << "," << b << ")" << endl;
}
private:
    int a;
    int b;
};

class bar
{
public:
    bar(foo F);
    ~bar() {};
    void print(ostream & os) { os << x << endl; }
private:
    int x;
};

bar::bar(foo F)  // ctor from foo
{  x = F.getval1();  }

int main()
{
    bar(foo(1,2)).print(cout);
}

Generated by  Doxygen 1.6.0   Back to index