Re: possible to skip code from sub functions?
- From: "not_a_commie" <notacommie@xxxxxxxxx>
- Date: 5 Mar 2007 10:22:40 -0800
Do this without an exception or a return value on any function:
class Jump {
void A() { if(some good reason) throw new Exception(); }
void B() { DestroyTheEarth(); }
void C() { Disarm() ; }
}
main() {
Jump j = new Jump();
try {
j.A();
j.B();
}
catch () { }
finally {
j.C();
}
}
Basically I'm wondering if I can code my own try/catch/finally
structure. I was picturing passing my own exceptions into the try
function and my own delegates to call on catch/final as well. I could
then have my classes call my own throw function. What I can't figure
out how to do is make it skip code. Can I, from my own code, force an
exit from the current scope? Or make it jump back to the scope level
that my custom Try function was called at?
.
- Follow-Ups:
- Re: possible to skip code from sub functions?
- From: Göran Andersson
- Re: possible to skip code from sub functions?
- References:
- possible to skip code from sub functions?
- From: not_a_commie
- Re: possible to skip code from sub functions?
- From: Göran Andersson
- possible to skip code from sub functions?
- Prev by Date: Enterprise Library Data Block and Access database
- Next by Date: Re: Regex Help Required
- Previous by thread: Re: possible to skip code from sub functions?
- Next by thread: Re: possible to skip code from sub functions?
- Index(es):
Relevant Pages
|