0
Confused
#include <iostream> using namespace std; class BankAccount { public: void sayHi() { cout << "Hi" << endl; } }; int main() { BankAccount test; test.sayHi(); } was hoping someone could walk me through what's happening here. I see we're creating a class and making it public but get lost after that.
2 Respostas
+ 1
Well I'm not an expert in c++ but since you're in the class lesson. You're making a method "sayHi" and "test" is basically your object of the class BankAccount and "test.sayHi();" is you using the object with the method. This will output "Hi".
0
but what's going on with the void part and then the int main and test.sayHi?