问题描述
[]
所以你看到这里他有3个文件:main.cpp,Sally.h和Sally.cpp,他在Sally.cpp文件中定义了一个void函数,语法为void Sally :: printCrap()。我很困惑,为什么他要把类的名称用于在类外定义一个函数?有人可以解释一下吗。我真的很感激!
我的尝试:
对于小而不详细的问题很抱歉,但我限于200个字符:XI希望你理解我的问题,并希望你能解释我。
谢谢!
Buckys C++ Programming Tutorials - 42 - Arrow Member Selection Operator - YouTube[^]
So you see here he has 3 files: main.cpp, Sally.h and Sally.cpp and he is defining a void function in the Sally.cpp file with syntax void Sally::printCrap(). I got confused in that why he is putting the name of the class for defining a function in outside the class ? Can someone explain me that. I will be really thanksful!
What I have tried:
Sorry for the small and not detailed question but I am limited to 200 characters :X I hope you understood my question and hope you will explain me that.
Thanks!
推荐答案
这篇关于与C ++ OOP混淆了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!