In which line is the object named 'test', at 'BankAccount test;' or at 'test.sayHi();'? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

In which line is the object named 'test', at 'BankAccount test;' or at 'test.sayHi();'?

int main() { BankAccount test; test.sayHi(); }

9th Apr 2019, 5:48 PM
Msizi
2 Answers
+ 2
Maybe I get the question wrong, but "BankAccount test" basically says "Create an object of type 'BankAccount' which will be named 'test'" Let me know if this answers your question.
9th Apr 2019, 6:11 PM
Alex
Alex - avatar
+ 8
you could say "test" is the object but really its just a reference to were the object is in memory Object.methods()
9th Apr 2019, 6:22 PM
D_Stark
D_Stark - avatar