0

hello everybody,
i started learning vb.net around 3-4 days ago. And now i playing with operators . There i have one doubt :

is it possible to treat string value like a operator ?

for example : let suppose , there are 2 variable named a ,b of integer type which will store 2 numeric values. and one variable of string type named opertor_type of string type which will store the operator symbol.

a=10
b=20
operator_type="+"

and here is where my doubt arise

a operator_type b              'for a+b

is that kind of statement allowed in vb.net or not ?
However i done it using switch statement.

Edited by Learner010

2
Contributors
2
Replies
7
Views
3 Years
Discussion Span
Last Post by Learner010
0

What you are trying to do is indeed not possible.
There is something like operator overloading, but it is rarely needed in every day use of VB, so I would not spoil my learning energy on it right now.

0

thanks for quick reply.
i wanted to know to if there exist any other way to use strings as operator but i didn't find any useful that's why i created thread here and now i am sure that this is really very rare .

thanks.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.