Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

making a separate file for classes

Status
Not open for further replies.

kmfna

MIS
Sep 26, 2003
306
US
Hello all,

I am working on a program that has 20+ custom classes. The question is, can I put these into a separate file and include it? In C++ I would have just made a header ".h" file and included it. I know it isn't necessary, but all of these classes are serving to make my form code look unnecessarily long. Any ideas??

Thanks

Kevin

- "The truth hurts, maybe not as much as jumping on a bicycle with no seat, but it hurts.
 
You can put all your classes into a single file, or put each class into each own file.

What I do is put them in separate file (named after the class), except when two or more classes are so tightly coupled that there's no way to use one without the other, and then I'll put them in the same file.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Chip,

Thats cool, I understand how I would do it, with respect to putting them in the files, but the question is, how do I create the file?? (sorry I guess my question was a bit fuzzy) Is there some other file, like a c++ header file that I can use? Then, do I just type "using" and the name of the file?

Thanks again,
Kevin

- "The truth hurts, maybe not as much as jumping on a bicycle with no seat, but it hurts.
 
Just create the file with your class, if it is in a different namespace you will have to add "using myNamespace", as long as they are all being compiled into the same assembly you should not have a problem.

If you are using visual studio, just right click on the solution exporer and choose Add a new item->Class, and it will create a new file with an empty class for you.

 
ahhh.....gotcha. I felt really stupid having to ask.

Thanks a lot,

Kevin

- "The truth hurts, maybe not as much as jumping on a bicycle with no seat, but it hurts.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top