Ask Question
4 August, 10:00

In c + + when you create a class and you don't want to put the class and the main program in one source file and let's say you create two separate source files one for the class and one for the program how do you make use of the class in the source file for the main program

+2
Answers (1)
  1. 4 August, 10:02
    0
    Usually, you make a header file of the class with it's prototype and include it in your main program using double quotes instead of. This is how it's done with libraries that are compiled. In your case, this leaves the Class. cpp file unlinked. You could put an include at the end of the header file, or in this case I believe that you can just include the Class. cpp in your main source:

    #include "Class. cpp"
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “In c + + when you create a class and you don't want to put the class and the main program in one source file and let's say you create two ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers