mail-archives/mono-osx/2010-October/003220.html

100 строки
3.2 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mono-osx] how override an Objective C method?
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:mono-osx%40lists.ximian.com?Subject=%5BMono-osx%5D%20how%20override%20an%20Objective%20C%20method%3F&In-Reply-To=2574EA58-B932-4188-A2CE-6914BC4DB767%40v-fx.com">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="003219.html">
<LINK REL="Next" HREF="003224.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mono-osx] how override an Objective C method?</H1>
<B>Miguel de Icaza</B>
<A HREF="mailto:mono-osx%40lists.ximian.com?Subject=%5BMono-osx%5D%20how%20override%20an%20Objective%20C%20method%3F&In-Reply-To=2574EA58-B932-4188-A2CE-6914BC4DB767%40v-fx.com"
TITLE="[Mono-osx] how override an Objective C method?">miguel at novell.com
</A><BR>
<I>Wed Oct 27 11:50:49 EDT 2010</I>
<P><UL>
<LI>Previous message: <A HREF="003219.html">[Mono-osx] how override an Objective C method?
</A></li>
<LI>Next message: <A HREF="003224.html">[Mono-osx] how override an Objective C method?
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#3220">[ date ]</a>
<a href="thread.html#3220">[ thread ]</a>
<a href="subject.html#3220">[ subject ]</a>
<a href="author.html#3220">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>Hello,
I want to override +(bool)[NSObject respondsToSelector:sel].
&gt;<i>
</I>
The signature above is for a static method, not an instance once (+ vs - in
the signature).
&gt;<i> My best guess is this, but the app crashes inside the call to the base
</I>&gt;<i> method.
</I>&gt;<i>
</I>&gt;<i> [Export(&quot;respondsToSelector:&quot;)]
</I>&gt;<i> public override bool RespondsToSelector (Selector sel)
</I>&gt;<i> {
</I>&gt;<i> bool result = base.RespondsToSelector(sel);
</I>&gt;<i> return result;
</I>&gt;<i> }
</I>&gt;<i>
</I>
Do not use the [Export] if you are overriding an existing method that is
already defined.
Miguel.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <A HREF="http://lists.ximian.com/pipermail/mono-osx/attachments/20101027/e51379ce/attachment.html">http://lists.ximian.com/pipermail/mono-osx/attachments/20101027/e51379ce/attachment.html</A>
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="003219.html">[Mono-osx] how override an Objective C method?
</A></li>
<LI>Next message: <A HREF="003224.html">[Mono-osx] how override an Objective C method?
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#3220">[ date ]</a>
<a href="thread.html#3220">[ thread ]</a>
<a href="subject.html#3220">[ subject ]</a>
<a href="author.html#3220">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/mono-osx">More information about the Mono-osx
mailing list</a><br>
</body></html>