MyClass ht; does not create any object. Instead, it creates a variable (a reference) of type MyClass, and sets its value to null. No object is created. To create an object, you need to explicitly call the class constructor with a new.
MyClass ht = new MyClass();
You can also use ht to refer to an instance of MyClass that has been created (with a new) at some other point in your code.
MyClass myClass = new MyClass();
......
MyClass ht;
......
ht = myClass; // both ht and myClass are references to the same object...
Your managed code doesn’t have a destructor, just a finalizer. The difference is a destructor (as in C++) fires immediately when an object goes out of scope, but a finalizer is run when the CLR’s garbage collector (GC) gets to your object. It’s not deterministic when this will occur, but it’s very unlikely to occur right after the object goes out of scope. It will happen at a later time, however.
(from sburke_online@microsoft..nospam..com on microsoft.public.dotnet.framework.windowsforms)
In the .NET framework, you use the SystemInformation class from the System.Windows.Forms namespace. This class has comparable information to what GetSystemMetrics() returned in VC6. There is also a Screen class that contains additions display device properties.
1] The conditionals in if-statements must calculate to a boolean value. You cannot write something like
if (nUnits) { ... }
where nUnits is a int.
2] All code must reside in a class. There are no global variables per se.
3] Bitwise & and | operators can be used with boolean types as logical operators. The && and || operators are also used, and do have the ‘short-cut calculation’ behavior found in C++. The & and | operators do not have this ”short-cut calculation’ behavior.
4] Pointers are not available in managed code.
5] In managed code, destructors are not hit immediately when as object goes out of scope. Ie, there is no deterministic destruction.