Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

Constructor/Destructor not being called

$
0
0
I just wanted to do some experiment with inheritance and virtual destructor, though before that I tested the base class with the code below, and noticed that no output appears in the console. Why is that? Is the compiler being super smart about it? #include <iostream> using namespace std; class Animal { public: Animal() { cout << "Animal Constructor Called" << endl; }; ~Animal() { cout << "Animal Destructor Called" << endl; }; }; int main() { { Animal Seal(); } return 0; }

Viewing all articles
Browse latest Browse all 17825

Trending Articles



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