I would like to write an interface class and use it like this
public Interface IFunction
property name as string
end interface
public class ModelFunction
implements IFunction
public property name as string
public sub new()
end class
*EDIT(deleted following sentence for being noob, thanks @damien_the_unbeliever for pointing this out):But this is not possible to get because a property in an vb.net interface has to be readonly or writeonly (as far as i get it)*
I have now written this but seems a little wrong:
public Interface IFunction
Readlonly property getName() as string
writeonly property writeName() as string
end interface
public class ModelFunction
implements IFunction
....
end class
Anyone have a better solution for this? or can help me out with properties in an Interface class. Have read some articles here on stackoverflow but none of them point me in the right direction.
This works fine for me:
There’s even an example on the documentation page for
Interface: