Stellen Sie eine FrageStellen Sie eine Frage
 

Beantwortetdefining a struct

  • Mittwoch, 4. November 2009 18:20cpzao TeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     Enthält Code
    Hello,

    I'm building a windows forms application and at this moment, I'm developping a class which will be used by the form application. On this class I declared a struct:

    struct XPTO{
        unsigned char DIP;
        unsigned char DOP_1;
        unsigned char DOP_2;
    };
    I would like to declare this struct as a global variable, which I can afterwards call on the Form.

    In the middle of a function I do fine by doing:

    XPTO my_XPTO;

    and I can access it by my_XPTO.DIP = 10;

    But when I try to declare it as public I get an error:

    error C4368: cannot define 'my_XPTO' as a member of managed 'Class_Name': mixed types are not supported.

    What am I doing wrong?

    Thanks in advance for helping!

Antworten

Alle Antworten