I mean:
Here I got a copy of the object, and a copy constructor. Will be there copy of the object?Code:#include <iostream> using namespace std; class B { public: B() { cout<<"test"; } int n; }; class test { private: int y; public: int z; test() { y=1; } test(B object) { y=object.n; } void print_y(); }; void test::print_y() { cout<<y<<endl; } int main() { B ob2; B ob3; cout<<"Put whatever you want"; cin>>ob2.n; test ob1(ob2); ob1.print_y(); system("PAUSE"); }




Reply With Quote
