By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,836 Members | 2,097 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,836 IT Pros & Developers. It's quick & easy.

header and code files structure

P: n/a
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
Aug 16 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
tomb wrote:
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.

--
David Wilkinson
Visual C++ MVP
Aug 16 '07 #2

P: n/a


David Wilkinson wrote:
tomb wrote:
>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.
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
Aug 16 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.