+ 3

I have a few question about structs.

What is the meaning of struct example* function()? What kind of a function we had defined?

10th Jul 2017, 12:35 PM
Yusuf
Yusuf - avatar
1 Odpowiedź
+ 9
Consider: #include <iostream> struct example { example* func() { return this; } // This is a function which returns the address of its own instance of the structure. }; int main() { example obj; std::cout << obj.func(); return 0; }
10th Jul 2017, 4:20 PM
Hatsy Rei
Hatsy Rei - avatar