every c program is converted to machine code, if this binary is distributed. Since the instruction set of a computer is well known, is it possible to get back the C original program?
i came across this line is stroustrup An operator function must either be a member or take at least one argument of a user-defined type (functions redefining the new and delete operators need not).
Dont operator new and operator delete take an user defined type as one of their arguments?
what does it mean, am i missing something here
I have this code [tableView deselectRowAtIndexPath:indexPath animated:YES];
Why doesn't the table view deselect the row, What am i doing wrong.
EDIT:
-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
If you overload - like operator-(), it is to be used to the left of the object, however overloading () like operator()() it is used to the right of the object. How do we know which operator is to be used on the left and which ones to be used on the right?
If we define a member function inside the class definition itself, is it necessarily treated inline or is it just a request to the compiler which it can ignore.
does the Destructor deallocate memory assigned to the object which it belongs to or is it just called so that it can perform some last minute housekeeping before the object os deallocated by the compiler?
i have this code
#include <iostream>
using namespace std;
class Test{
public:
int a;
Test(int i=0):a(i){}
~Test(){
cout << a << endl;
}
Test(const Test &){
cout << "copy" << endl;
}
void operator=(const Test &){
cout << "=" << endl;
}
Test operator+(Test& p){
Test res(a+p.a);
return res;
}
};
int main (int argc, char const *argv[]){
Test t1(10), t2(20);
Test t3=t1+t2;
return 0;
}
Output:
30
20
10
Why isnt the copy constructor called here?