0
Destructor
I am looking at C# tutorial, module 6, section 45, "Destructor". Somehow, my output only have constructor, it doesn't have destructor. And the result is different from the tutorial. I don't know what did I do wrong. (I am using the free version of visual studio 2017 for this code.) class Program { class dog { public dog() { Console.WriteLine("Constructor"); } ~dog() { Console.WriteLine("Destructor"); } } static void Main(string[] args) { dog d = new dog(); Console.ReadKey(); } result: Constructor
1 Réponse
0
Hey, try to remove the Console.ReadKey();
I've tried it, and the result is :
Constructor
Destructor