New course! Every coder should learn Generative AI!
Try a free lesson+ 1
why we are using this lendthy method?
#include <iostream> using namespace std; class MyClass { public: MyClass(); void myPrint(); }; MyClass::MyClass() { } void MyClass::myPrint() { cout <<"Hello"<<endl; } int main() { MyClass obj; obj.myPrint(); } we can also use only- #include<iostream> using namespace std; int main() { cout << "Hello World"<<endl; return 0; }
1 Answer
+ 1
I think it's just an example of implementing a class in C++ and not the real-world implementation