Property returning a different type than declaration

E

Eniac

Hi there,

is there any way I can make a property returning another type than what
is declared in the "as" statement ?

ex.:

public property Age as Integer
Get
return m_intAge
End Get
Set (Value as object) '<-- note that the SET accepts an object
If isnumeric(age) andalso ctype(value, integer) > 0 then
m_intAge = ctype(value, integer)
else
m_intage = -1
end if

End Set

I'm just trying to build a set of property that take objects as input
but return specific types like string, integer, boolean..etc.

Right now they're all declared as object but it forces the caller to
cast the return value in the appropriate type.

I know it cannot be done directly (i think) but is there any workaround
I can use ?

Thanks!
 
E

Eniac

Just thought I'd bump this one since I'm still in the dark, maybe
someone more experienced than I will see read it.

^.^
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,133
Latest member
MDACVReview
Top