Whats the deal with prototype functions in managed C++
Okay,
I have bought a book on managed C++ and a reference book to .NET and am already starting to code. I am finding the coding quite intuitive and powerfull however I am curious, has microsoft done away with function prototyping.
It seems to me that all the function definitions is done in the header file that's code and parameters etc. Is it no longer nessesary to have the code in the .cpp file?
Thanks,
Jonathan.
# 1 Re: Whats the deal with prototype functions in managed C++
Generally I try VERY hard to limit function definitions in header files. I do the declarations there, of course, but almost always move the definitions to the .cpp file.
Even the event handlers that the IDE places in the header are generally limited (in my code) to a single statement, maybe two. For me, five statements in a single function would be way too much for a header file.
Even the constructor is largely limited to three or four statements.
My reason for doing that is that when I read a header file, I want a quick look at the function, its properties, variables, and methods. I DON'T want details.
But, that's really a matter of personal preferences (and, perhaps, an indication of my age - I'm definitely old school ... W-a-a-a-y old school).
bill
# 2 Re: Whats the deal with prototype functions in managed C++
You didn't need to have the code in the .cpp file in native C++ : you could write 'inline' functions in the class definition.
You can do either : personally I always seperate the code into .h and .cpp because it makes the .h far more readable.
Darwen.
darwen at 2007-11-9 12:08:42 >
