Ask Question
4 October, 21:25

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

+1
Answers (1)
  1. 4 October, 23:26
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers