G
Guest
Hello,
I'm back from some old fashioned project and something has changed in
comparison to my first hours of programming in Visual C++. I'm up to build a
tool and started by means of the Express Edition 2005 of VC++ aka VCM++.
I decided to use the advantages of Managed Code but I'm wondering about the
designer generated code.
It's a Windows Form App. I use Managed Strings and other built in types.
My question is if I instantiate an object of type Int32 or Double or String
have I order to delete such objects explicitly or is GC doing it.
As I can see the code designer doesn't add code to order to destroy such
objects explicitly but for one it is doing it.
System::ComponentModel::Container ^components;
and in the destructor
if (components) {
delete components;
}
As I read all members will be implicitly destroyed when they come out of
scope.
Does this also include the reference members?
I read some articles from the msdn mag and know how the finalize mechanism
works but I'm just unsure since as I started to program I used the old new,
delete mechanism which is obsolete now. Please let me know what can I do to
avoid misdesigns. May be it's to basic for the good old programer on this
thread but please help. Thanks in advance.
I'm back from some old fashioned project and something has changed in
comparison to my first hours of programming in Visual C++. I'm up to build a
tool and started by means of the Express Edition 2005 of VC++ aka VCM++.
I decided to use the advantages of Managed Code but I'm wondering about the
designer generated code.
It's a Windows Form App. I use Managed Strings and other built in types.
My question is if I instantiate an object of type Int32 or Double or String
have I order to delete such objects explicitly or is GC doing it.
As I can see the code designer doesn't add code to order to destroy such
objects explicitly but for one it is doing it.
System::ComponentModel::Container ^components;
and in the destructor
if (components) {
delete components;
}
As I read all members will be implicitly destroyed when they come out of
scope.
Does this also include the reference members?
I read some articles from the msdn mag and know how the finalize mechanism
works but I'm just unsure since as I started to program I used the old new,
delete mechanism which is obsolete now. Please let me know what can I do to
avoid misdesigns. May be it's to basic for the good old programer on this
thread but please help. Thanks in advance.