Quantcast
Channel: User Oswald - Stack Overflow
Viewing all articles
Browse latest Browse all 36

Answer by Oswald for Can functions of class be accessed by pointers, without creating actual objects?

$
0
0

b->display(); yields undefined behavior. That means, whatever your computer does at that moment is good enough.

The question of where b->a is stored makes no sense, because accessing b->a yields undefined behavior.

In some cases, C++ is not obliged to tell you that you screwed it up. Dereferencing a pointer to uninitialized memory is such a case.


Viewing all articles
Browse latest Browse all 36

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>