vb.net - How to shadow an interface property? -
i've got generic interface inherits non-generic interface. somehow compiler does't how i've done this. i'd appreciate in figuring out how accomplish inheritance in manner compiler doesn't whine about.
public interface imessage property messagetype uint16 property payload object end interface public interface imessage(of t) inherits imessage shadows property payload t end interface public class message(of t) implements imessage(of t) ' <-- line highlighted in vs. public property messagetype uint16 = 0 implements imessage(of t).messagetype public property payload t = nothing implements imessage(of t).payload end class
class 'message' must implement 'property payload object' interface 'imessage'. implementing property must have matching 'readonly' or 'writeonly' specifiers.
shadows property payload t
by using shadows, tell compiler payload property intentionally not match base property. generic interface has two properties, 1 as object
, other as t
. implementing interface therefore requires implement them both:
public class message(of t) implements imessage(of t) public property messagetype uint16 = 0 implements imessage(of t).messagetype public property payload t = nothing implements imessage(of t).payload private property payload1 object implements imessage.payload return payload end set(value object) payload = ctype(value, t) end set end property end class
this not want do, i'm sure. best address real problem, there no visible use non-generic interface. if have 1 anyway snippet shows it.
Comments
Post a Comment