C++ class construction question

Ideas and dreaming will go this forum
Post Reply

smartsmurf
Official SamyGO Developer
Posts: 111
Joined: Thu Jun 24, 2010 8:26 am
Location: Frankfurt, Germany

C++ class construction question

Post by smartsmurf »

At the moment I am fiddeling with some exeDSP exports. For example this one:

Multimedia::MediaPlayer::Music::CMusic::GetDlnaMediaInfo(char *, Multimedia::_tMediaInfoContext *)
(mangled name: _ZN10Multimedia11MediaPlayer5Music6CMusic16GetDlnaMediaInfoEPcPNS_18_tMediaInfoContextE)

My question is: how can I achieve a class structure like that? Especially the multiple "::"? Any hints?
nbd
Posts: 160
Joined: Wed Jan 13, 2010 12:02 pm

Re: C++ class construction question

Post by nbd »

I presented this problem to a colleague of mine, and got the following example:

Code: Select all

#include <iostream>

using namespace std;

namespace WHOOPS
{
        class A {
        public:
                class B
                {
                public:
                        class C
                        {
                        public:
                                bool gotIt(void);
                        };
                        C c;
                };
                B b;
        };
}

bool WHOOPS::A::B::C::gotIt(void)
{
        cout << "I got it!" << endl;
        return true;
}

int main(char **argv, int argc)
{
        WHOOPS::A a;
        a.b.c.gotIt();

        return EXIT_SUCCESS;
}
smartsmurf
Official SamyGO Developer
Posts: 111
Joined: Thu Jun 24, 2010 8:26 am
Location: Frankfurt, Germany

Re: C++ class construction question

Post by smartsmurf »

Great! That's it. Thank you and best regards to your colleague... ;)

Post Reply

Return to “[B] Brainstorm”