Jump to content

Recommended Posts

Posted

I am brushing up on my c++ knowledge after not using it for some time.

I know that function headers are put in files with the "h" extensions but is it ok to put the actual function in the same file? Or is it considered bad form??

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Posted

Yeah, I had forgotten that. It works ok but I won;t do it in my current le3 project.

In my le2 game the code was getting a bit bulky so I decided to put all my functions in a seperate file. I called it func.h. I guess it should have been called finc.cpp

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Posted

I think it's fine to put your getters and setters in your headers, but anything above that I'd put everything else in the .ccp IMO. I've ran into some linker errors when playing around with objects in the header and were real hard to track down.

trindieprod.png?dl=0spacer.png?dl=0steam-icon.png?dl=0twitter-icon.png?dl=0spacer.png?dl=0
Posted

At the time I had forgotten about prtotyping and forward references. All the variables were declaed inside main. but it worked.

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
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...