0

I made a class and in my class I have alot of macros, templates, structs and unions. The class just shows data members and methods. How do I define the macros, struct and union in my class? Kindly guide me.

Conner
  • 30,144
  • 8
  • 52
  • 73
Model
  • 61
  • 2
  • 13

1 Answers1

0

It's quite difficult to guide you because your question's a bit unclear. That being said, you can define nested structs and unions like this, if that's what you're asking:

class C
{
    struct S
    {
        int x;
    };

    union U
    {
       int i;
       char c;
    };
};

As to macros, you don't define them within a class definition.

It might be worth getting a hold of a good book to help you with questions like this. My suggestion is something like C++ Primer (Lippman and Lajoie) -- I learnt C++ from it back in the day and found it to be pretty good.

Stuart Golodetz
  • 20,238
  • 4
  • 51
  • 80
  • i have to show struct an union and macros in my class.. i ma making class diagram...so i am not getting how i show it.. – Model Nov 07 '10 at 15:14
  • Ah sorry - I didn't realise what you meant. As far as nested structs go, you can just represent them the same way you would represent a nested class (e.g. see nesting, inner class on this page: ). As to unions, I'm not sure unfortunately, sorry. And I'd be surprised if there's a specific way to represent macros. – Stuart Golodetz Nov 08 '10 at 00:11
  • i want o make a project design and have to make a class digram and also activity diagram.. please guide me how i handle macros and struct in my class,.. or in activity.. – Model Nov 08 '10 at 00:37
  • can you add me in any messenger.. because i want to tell you my problems in detail.. please if its possible to you.. – Model Nov 08 '10 at 00:39
  • my id is rabiafyz87@gmail.com – Model Nov 08 '10 at 00:43
  • ok please tell me that each use case have activity diagram right.. now let say use case is contain operation that user an perform.. now my contain operation goes from two functions i mean Function A calls to Function B.. now should i make it in sequence or activity.. please help me in this regard – Model Nov 08 '10 at 00:47
  • i put some use cases like contain, touches,relate and now i have to make activity diagram because each sue cse have activity.. – Model Nov 08 '10 at 01:26
  • can i do chat with you on messenger for more discussion.. i can texplain my problem better than here.. please if possibel than do chat with me on it.. – Model Nov 08 '10 at 01:27
  • Wow that's a *lot* of comments right there :) I'm not really an expert on UML diagrams to be honest -- I told you pretty much all I knew about the problem in my comment above unfortunately. If you need more, I think a book like "UML in a Nutshell" might be the way to go, or Google for things. That's how I usually find stuff like this out, for what it's worth. Sorry! – Stuart Golodetz Nov 08 '10 at 12:08