Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Differences with a destroyer
Message
De
30/11/2008 10:09:01
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Programmation orienté objet
Versions des environnements
OS:
Windows XP SP2
Network:
Windows XP
Divers
Thread ID:
01364440
Message ID:
01364703
Vues:
13
>>>>>>In Visual C++.Net what is the difference between destroyer,Finalize and Dispose?
>>>>>>Thank you in advance
>>>>>>Luis Martin
>>>>>
>>>>>This is C#.NET, not C++.NET, so I can't promise it's the same. In C#.NET the Finalize() method cannot be called directly but is invoked by the garbage collector when an object is cleaned up. Normally it does not need to be coded. The exception is if the object utilized unmanaged resources like COM objects. Dispose() is similar but can be called. Its purpose is to release so-called precious resources like database connections immediately rather than waiting for the garbage collector to release them.
>>>>>
>>>>>Actually I suspect it's the same in C++. It's a .NET thing, not a language thing.
>>>>
>>>>Hi,
>>>>Probably worth pointing out that a class needs to implement IDisposable to use .Dispose().
>>>>(Well - not stricly true but not much reason to have a .Dispose otherwise....)
>>>>
>>>
>>>I knew that! I must actually be learning something.
>>>
>>>However, I have to admit that the penny hasn't really dropped for me about interfaces. I still haven't recognized the benefit. An interface doesn't give you any code at all, just prototypes of methods you have to code yourself. I know they are widely used so it will probably make sense to me one of these days.
>>_______________
>>I look at it this way: In C# a class can have one and only one direct parent class, ie a class cannot inherit from multiple classes. That is why they invented the interface
>
>I know you can only inherit from one class. Had not made the connection that this is the reason for interfaces. When you implement an interface you don't actually inherit anything but a blueprint to follow, do you?
___
Yes, that is my understanding. You inherit a blueprint which you have to implement, eg
ICollection : http://msdn.microsoft.com/en-us/library/y2fx0ty0.aspx
Gregory
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform