Destructors and Class definition with Instant Generator C++

Hi,

I’m using VP for uml Prof Ed

How can I generate the destructor of a class ?
How do I change the generated definition “public class xxx” by simply “class xxx” ?

Thanks

Hello Victor M Guzman,

I prepared a movie to answer your 2 questions. Please watch at:
http://files3.visual-paradigm.com/200703/Jick/destructor.htm

The key point to generate destructor is to set the programming language from UML to C++.

Hope the movie has helped. Please feel free to let me know if there are any questions.

Best regards,
Jick

Hi,

I tryed this and note that:

Definition of classes declared with undefined visibility is “private class”, same if declared private visibility. Other options (public and protected) work fine.

If define destructor and constructor, only the first in the operation list of the class is generated.

I tryed enterprise edition and professional edition with same results

Thanks a lot by your time

Hello Victor M Guzman,

How are you? I just tried playing with the Instant Generator feature. Below are my comments.

Definition of classes declared with undefined visibility is “private class”

Isn’t ‘private’ the default visibility of class? I am not an expert in C++, would you mind providing me with more information about the problem? Sorry about this.

If define destructor and constructor, only the first in the operation list of the class is generated.

I just found a case that, if the constructor and destructor have the same signature, only the first one will be handled in instant generation. I have reported this problem to our engineers. Is this your case? If you don’t mind, you may send me your project so that we can test in detail.

Best regards,
Jick

Hi.
Below more information.

Isn’t ‘private’ the default visibility of class? I am not an expert in C++, would you mind providing me with more information about the problem? Sorry about this.

Neither I’m an expert, although the compiler rejects a visibility qualifier in the class name. In the class definition (header file), only attributes and operations use visibility qualifier (public, protected,private). The class visibility depends on his namespace. I’m using g++.

I just found a case that, if the constructor and destructor have the same signature, only the first one will be handled in instant generation

This is just my problem. Only if constructor and destructor differs in name or the constructor uses parameters, then both are generated.

Hello Victor,

Thank you for your reply.

About the visibility of class, as a conclusion, do you mean that, it should not show the visibility when the class visibility is defined as Unspecified? I would like to collect more detail and discuss with our developers. Thank you for your help.

About the problem of unable to generate constructor and destructor, I suppose this is more like our problem than yours. I actually asked our engineers to fix that, and this has been fixed already. I think that the fix will be available in this few days. Thanks to your report.

I look forward to hearing from you.

Best regards,
Jick

Hello Jick,

About the visibility of class, as a conclusion, do you mean that, it should not show the visibility when the class visibility is defined as Unspecified?

That’s right. In case of generate C++ code, indeed no visibility qualifier in class name (opposing to java).

About the problem of unable to generate constructor and destructor, I suppose this is more like our problem than yours. I actually asked our engineers to fix that, and this has been fixed already. I think that the fix will be available in this few days.

Thanks

Thanks Victor, I will discuss with our developers in further.

Hello Victor,

How are you? I am happy to let you know the the problem about including the class visibility is fixed. Please run the updater to update to the latest release.

Feel free to contact me if there are any questions.

Best regards,
Jick