Name: Anonymous 2009-02-20 18:36
yo guys, just came across this mad piece of hardcore code, can anyone tell me what it does:
if(1) 1 ? 0 : 1;
if(1) 1 ? 0 : 1;
if() ? : ;).
inline int question_mark_operator(int statement)
{
if(statement)
return 0;
else
return 1;
}
int main(int argc, char* argv[])
{
if(1)
question_mark_operator(1);
}
class ternary
{
public:
ternary(int statement_) : statement(statement_) {}
ternary() : statement(0) {}
int question(int a, int b)
{
if(statement)
return a;
else return b;
}
int statement;
};
int main(int argc, char* argv[])
{
ternary test(1);
if(1)
test.question(1);
}
class ternary
{
public:
ternary(int statement_) : statement(statement_) {}
ternary() : statement(0) {}
int question(int a, int b)
{
if(statement)
return a;
else return b;
}
int statement;
};
int main(int argc, char* argv[])
{
ternary test(1);
if(1)
test.question(0, 1);
}
class ternary
{
public:
virtual int question(int statement) = 0;
};
class my_question : public ternary
{
public:
int question(int statement)
{
if(statement)
return 0;
else return 1;
}
};
void test_question(ternary* p)
{
p->question(1);
}
int main(int argc, char* argv[])
{
ternary* q = new my_question;
if(1)
test_question(q);
delete q;
}