Is it possible to avoid repeating the class name in the implementation file?

后端 未结 8 2047
迷失自我
迷失自我 2020-11-27 21:39

Is there a way to avoid the Graph:: repetition in the implementation file, yet still split the class into header + implementation? Such as in:

Header Fi

8条回答
  •  误落风尘
    2020-11-27 22:03

    If you want to avoid typing the "Graph::" in front of the printGraph, addEdge etc., then the answer is "no", unfortunately. The "partial class" feature similar to C# is not accessible in C++ and the name of any class (like "Graph") is not a namespace, it's a scope.

提交回复
热议问题