Jump to content

C++ Function Prototyping?

mattonfire

Is function prototyping a good idea, as in professional or not? Generally what would be better that, or just have the function at the top.

Link to comment
Share on other sites

Link to post
Share on other sites

Without function prototyping you can't link functions between source files, the best way is having a source file (i.e. Source01.cpp) and a header file for each source file (i.e. Source01.h) where you'll write your prototypes. Then include the header in his source and where you need it.

 

Someone already answered this question on SO, he agrees with me.

http://stackoverflow.com/a/2575186/5501669

Link to comment
Share on other sites

Link to post
Share on other sites

When you're making classes that have functions then you're using function prototypes (assuming header declaration with source definition). Does this make the most used core feature of any OOP languages unprofessional?

CPU: Intel i7 - 5820k @ 4.5GHz, Cooler: Corsair H80i, Motherboard: MSI X99S Gaming 7, RAM: Corsair Vengeance LPX 32GB DDR4 2666MHz CL16,

GPU: ASUS GTX 980 Strix, Case: Corsair 900D, PSU: Corsair AX860i 860W, Keyboard: Logitech G19, Mouse: Corsair M95, Storage: Intel 730 Series 480GB SSD, WD 1.5TB Black

Display: BenQ XL2730Z 2560x1440 144Hz

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×