0

Suppose we have following two classes:

class Temp{
     public:
      char a;
      char b;
    };
    class Final{
     private:
      int a;
      char b;
      char c;
     public:
      Final(Temp in):b(in.a),c(in.b){}
      //rest of implementation
    };

can we initialize an object of the Final class with following syntax in upcoming c++0x standard:

Final obj(Temp{'a','b'});
2
Contributors
1
Reply
3
Views
7 Years
Discussion Span
Last Post by mike_2000_17
0

Well, at least with the current draft of C++0x, as implemented by the newest linux g++ compiler (with flag "-std=c++0x"), all of the following work, but not the _exact_ syntax you have up there.

Temp t = {'a','b'};
Final obj(t);
Final obj2({'a','b'});
Final obj3(Temp({'a','b'}));
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.