D - Cast causes access violation
- Johnny (10/10) Mar 18 2004 I've got a class called Regex wich is an subclass of the interface Autom...
- Ilya Minkov (7/22) Mar 18 2004 I think you should reduce this to a minimum self-contained example which...
- johnnyvdlaar hotmail.com (15/37) Mar 18 2004 public interface Automate {}
I've got a class called Regex wich is an subclass of the interface Automate. In
some function I have a parameter which takes an automate.
public void fromAutomate(in Automate from)
{
Regex ex = (Regex)from;
}
I am sure this is a Regex because running the interface methods work as
expected. However, casting the Automate to the regex causes an access violation.
Please help,
Johnny
Mar 18 2004
I think you should reduce this to a minimum self-contained example which
compiles and fails in this manner (up to 20 lines of code) and try to
post it with a [bug] in subject line. Walter needs such to find bugs and
maintain a set of tests.
Else i don't see what would be causing it.
-eye
Johnny schrieb:
I've got a class called Regex wich is an subclass of the interface Automate. In
some function I have a parameter which takes an automate.
public void fromAutomate(in Automate from)
{
Regex ex = (Regex)from;
}
I am sure this is a Regex because running the interface methods work as
expected. However, casting the Automate to the regex causes an access
violation.
Please help,
Johnny
Mar 18 2004
public interface Automate {}
public class NDFA : public Automate {
public void fromAutomate(in Automate from) {
printf("%d\n", (Regex)from);
}
}
public class Regex: public Automate {}
int main() {
Regex regex = new Regex();
NDFA ndfa = new NDFA();
ndfa.fromAutomate(regex);
return 0;
}
and all he prints is a 0
In article <c3c42t$1fg$1 digitaldaemon.com>, Ilya Minkov says...
I think you should reduce this to a minimum self-contained example which
compiles and fails in this manner (up to 20 lines of code) and try to
post it with a [bug] in subject line. Walter needs such to find bugs and
maintain a set of tests.
Else i don't see what would be causing it.
-eye
Johnny schrieb:
I've got a class called Regex wich is an subclass of the interface Automate. In
some function I have a parameter which takes an automate.
public void fromAutomate(in Automate from)
{
Regex ex = (Regex)from;
}
I am sure this is a Regex because running the interface methods work as
expected. However, casting the Automate to the regex causes an access
violation.
Please help,
Johnny
Mar 18 2004








johnnyvdlaar hotmail.com