Jump to content

GOOP - overloading constructor


Recommended Posts

Hi you GOOP enthusiasts

I redesigned the last two weeks my current application using GOOP (loving it, by the way). Now I came across one point where I need to use an overloaded constructor.

I was wondering if it is good practice to use polymorphic VIs to do it or just forget about using overloaded methods.

Why I want to do this:

my current constructor has several inputs which were marked as "required" and now I need in one calling class just the generated object without any functionality (because of design reasons).

I'm really curious about your positions about that

cheers,

Christian

Link to comment

I guess you guys were all at the NI-Week the last couple of days, so that's why there was now answer.

I thought about the overloading method and I didn't see why I shouldn't do it...So I just did it....

I have now for that particular class two constructors. One Class_Create.vi with some recommendet and some required inputs (so basically I use an overloaded method already) and one Class_CreateEmpty.vi with no connectors at all.

Link to comment

I probably missed your first post.

For what it's still worth.. That's how I usually do it too..

Another way would be to have just one constructor and tell it how to construct using e.g. an enum parameter (the Report Generation VI's class does this), but this requires you to have all possible parameters for all construction actions. I wouldn't recommend that.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.