help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

vector RTE


From: ArbolOne
Subject: vector RTE
Date: Wed, 5 Sep 2012 06:47:43 -0700 (PDT)
User-agent: G2/1.0

class a_class{
public:
    int id;
    Glib::ustring fname;
};
std::vector<a_class>& my_class::my_method(){
a_class obj;
obj.id = 1;
obj.fname = "Me";

std::vector<a_class> v;
v.push_back(obj);

return v;
}
void a_method(){
    std::vector<a_class> v;
    my_class obj;
    v = obj.my_method();
}

The program above gives me an RTE(Run Time Error), what am I doing wrong?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]