Re: Overcoming C# limitations
- From: "Danny Liberty" <dliberty@xxxxxxxxx>
- Date: 19 Jun 2006 02:28:21 -0700
Nothing is hidden here. Every object's destructor is called when it
leaves scope. You might as well have defined a CString and have a
"hidden" destructor as you call it run when the function leaves. It's a
very simple design concept of programing in C++. I'm not debating
wether C# has done a better job, I'm sure it has. I was just asking if
I could somehow mimic some C++ features that in my opinion, make things
a bit easier to do.
james.curran@xxxxxxxxx wrote:
Danny Liberty wrote:
2. In C++ I could have defined a macro to instantiate an object and
then make a method call. For example:
#define MY_FUNC(x) MyObj a; a.func(x);
This would have been useful since I could use this macro in any scope
knowing that the destructor of MyObj (or instance a) will be called at
the end of the scope without explictly calling any function. For
example:
void Foo()
{
MY_FUNC(3);
.... more code....
} <-- destructor of MyObj would be called here
um... You want to hid the call to the ctor, and then have significant
action in the dtor. Forgive me, but I'm really glad I don't have to
maintain your code....
.
- Follow-Ups:
- Re: Overcoming C# limitations
- From: james.curran@xxxxxxxxx
- Re: Overcoming C# limitations
- From: Michael C
- Re: Overcoming C# limitations
- References:
- Overcoming C# limitations
- From: Danny Liberty
- Re: Overcoming C# limitations
- From: james.curran@xxxxxxxxx
- Overcoming C# limitations
- Prev by Date: Re: VS2005: edit while debugging
- Next by Date: Re: Integrate into Outlook
- Previous by thread: Re: Overcoming C# limitations
- Next by thread: Re: Overcoming C# limitations
- Index(es):
Relevant Pages
|