Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

java to c++

Name: Anonymous 2011-08-09 9:00


public class ``Faggot" {
    public void die();
}

static void main(String ``Faggots") {
    new ``Faggot"(){
        public void die() {
            suicide;
        }
    };
}


how would i port the following code to c++? mainly the part inside static void main method.

Name: Anonymous 2011-08-09 9:13

that is not valid Java.

Name: Anonymous 2011-08-09 9:15


public class Faggot {
    public void die();
}

static void main(String Faggots) {
    new Faggot(){
        public void die() {
            suicide();
        }
    };
}


there valid java, ``Faggot"

Name: Anonymous 2011-08-09 9:28

It doesn't translate to C++ because it uses Java's pseudo-closure feature of anonymous classes.

Also, sepplesox doesn't have real closures.

Name: Anonymous 2011-08-09 9:50

// This is your class motherfucker
class Faggot {
    // under public: go all public methods and variables
    public:
        // the Faggot method
        void die();
};

// Tell the compiler what the die() method does
void Faggot::die()
{
    // although I have a feeling that this is some built in java bullshit and won't actually work
    suicide();
}

int main() {
    // creation of MyFaggot object
    Faggot *MyFaggot = new Faggot();
   
    // execute the die() method
    MyFaggot->die();
   
    // return 0 to tell the OS everything went OK
    return 0;
}

Name: Anonymous 2011-08-09 9:57

>>5
Nope. The Java code made a (anonymous) subclass of faggot that commits suicide on death, whereas you made ALL faggots commit suicide on death.

Name: Anonymous 2011-08-09 10:02


// This is your class motherfucker
class Faggot {
    // under public: go all public methods and variables
    public:
        // the Faggot method
        void die();
};

// Tell the compiler what the die() method does
void Faggot::die()
{
    // although I have a feeling that this is some built in java bullshit and won't actually work
    suicide();
}

int main() {
    // creation of MyFaggot object
    Faggot *MyFaggot = new Faggot();
   
    // execute the die() method
    MyFaggot->die();
   
    // return 0 to tell the OS everything went OK
    return 0;
}


Forgot code tags...

Name: Anonymous 2011-08-09 10:27

>>6
Is it even possible to do that in C++?

Name: Anonymous 2011-08-09 10:29

>>8
Not yet.

Name: Anonymous 2011-08-09 11:31


class Faggot {
public:
    Faggot(void (*diefun)()) { die = diefun; }
    void (*die)();
};

void die1()
{
    suicide();
}

void main(void)
{
    Faggot fag(die1);
    fag.die();
}


this is as close as you get

Name: Anonymous 2011-08-09 11:38


class Faggot
{
public:
    void (Faggot::*die)();
};

int main(int argc, char* argv[])
{
    class DummyFaggot: public Faggot
    {
    public:
        void die()
        {
            suicide();
        }
    };
    Faggot* MyFaggot = new Faggot();
    MyFaggot->die = (void (Faggot::*)())&DummyFaggot::die;

    (MyFaggot->*(MyFaggot->die))();

    return 0;
}

Name: Anonymous 2011-08-09 12:36

Sepples Eleven from Java direction translation version:

class Faggot
{
public:
    virtual void die() = 0;
};

int main(int argc, char* argv[]) {
    class DummyFaggot : public Faggot
    {
    public:
        virtual void die() override {
           suicide();
        }
    };

    DummyFaggot f; // no need to use the heap, that's for bakas!
    return 0;
}


Sepples Eleven non-faggot translation version (considering the original program is essentially a no-op):

int main(int argc, char* argv[]) {
    return 0;
}

Name: Anonymous 2011-08-09 12:46

>>12-san here

Forgot to mention to all of the other posters, but when does the die method on the faggot anonymous class actually get called? It doesn't. He's just creating object on the GC heap of that anonymous type, that's all. So why are you all calling die in your posts? Am I the only one who can program in both Java and C++ (including Sepples Eleven).

Name: Anonymous 2011-08-09 18:55

JESUS CHRIST YOU FUCKING RETARD, YOU CLOSE \`\`PROPER QUOTES\'\' WITH TWO APOSTROPHES.

Name: Anonymous 2011-08-09 19:07

>>14
what are you doing ``Faggot''

Name: Anonymous 2011-08-09 19:09

>>15
Is this what /prog/ has come to, people who don't even know what escaped characters are?

Well \`\`faggot\'\', get the fuck back to whatever shitty hole you came from.

Name: Anonymous 2011-08-09 19:14

>>16
The fact that you're using escape characters on a text board makes you look like a moron, ``Faggot''

Name: Anonymous 2011-08-09 19:20

The way you type make you look like a moron all the time, fuck off or at least have the decency to sage your shitty posts.

Name: Anonymous 2011-08-09 19:46

>>18
fuck off, ``Faggot''. Go back to the imageboards

Name: Roger Bonheim 2011-08-09 22:48

while(1) {
puts("dick in my anus");
}

DON'T FORGET TO COMPILE WITH -STD=GNU99 because GNU/LINUX IS AN STD

Name: Anonymous 2011-08-09 23:27

>>20
while(your_mom_shoves_her_dildo_up_my_anus) {
  /* Pray she doesn't want to video tape this session */
}

Name: Anonymous 2011-08-09 23:43

>>21
#define >>21 ``Faggot''

Don't change these.
Name: Email:
Entire Thread Thread List