c++ - I want to overload "=" operator to assign value from an object to a non class int variable -


this question has answer here:

int i; integer a; //a class object  i=a; //here a's member variable value should assigned 'i' 

you can providing conversion operator class int:

class integer {  // ... stuff public:   operator int() const   { return member_to_assign; } }; 

Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -