header and code files structure

T

tomb

I had originally posted this to the comp.lang.C++.moderated group, and
was advised to bring this question here.

I haven't used C++ in quite a few years, and that was when I was
learning and made only console applications, but I remember the .h files
only had the function declarations, and the .cpp files had the
implementation. I just used the project wizard in .net 2003 to
start a new C++ project, .net forms style, and the private events for
the form are only showing up in the .h header file. ??? In fact, even
the constructor implementation is in the header file. Is this normal
for forms? Or has C++ changed?

Based on one of the responses posted in the other group, I was thinking
it may be better to transfer the actual functionality to the .cpp file
and put a function definition in the header, rather than having a bunch
of inline functions in the header to cover the form events. Does this
sound like the proper approach?

Tom
 
D

David Wilkinson

tomb said:
I had originally posted this to the comp.lang.C++.moderated group, and
was advised to bring this question here.

I haven't used C++ in quite a few years, and that was when I was
learning and made only console applications, but I remember the .h files
only had the function declarations, and the .cpp files had the
implementation. I just used the project wizard in .net 2003 to
start a new C++ project, .net forms style, and the private events for
the form are only showing up in the .h header file. ??? In fact, even
the constructor implementation is in the header file. Is this normal
for forms? Or has C++ changed?

Based on one of the responses posted in the other group, I was thinking
it may be better to transfer the actual functionality to the .cpp file
and put a function definition in the header, rather than having a bunch
of inline functions in the header to cover the form events. Does this
sound like the proper approach?

Tom:

C++ has not changed. What you see is a weakness of the WinForms class
designer, which is based on the C# one.

I am not an expert on Winforms, but I think it is possible (even
advisable) to move all the code except the InitializeComponent() method
to the .cpp file.
 
T

tomb

David said:
Tom:

C++ has not changed. What you see is a weakness of the WinForms class
designer, which is based on the C# one.

I am not an expert on Winforms, but I think it is possible (even
advisable) to move all the code except the InitializeComponent() method
to the .cpp file.
Thanks, David. That's what I was thinking, so if you're thinking that
way also, then that's what I'll do. It just makes more sense to me.

T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top