Regarding C++ Include another class

前端 未结 5 1617
孤城傲影
孤城傲影 2020-12-04 18:30

I have two files:

File1.cpp
File2.cpp

File1 is my main class which has the main method, File2.cpp has a class call ClassTwo and I want to c

5条回答
  •  悲&欢浪女
    2020-12-04 18:55

    you need to forward declare the name of the class if you don't want a header:

    class ClassTwo;
    

    Important: This only works in some cases, see Als's answer for more information..

提交回复
热议问题