60 likes | 193 Vues
Visual Basic.NET – Expression Dan Operator. Rully Yulian MF MCAD,MCPD,MCT,MVP VB.NET Independent IT Trainer - Application Developer http://www.yulianmf.com rully@yulianmf.com. Overview. Expression Operator Operator Precedence Operator Overloading. Expression .
E N D
Visual Basic.NET – Expression DanOperator Rully Yulian MF MCAD,MCPD,MCT,MVP VB.NET Independent IT Trainer - Application Developer http://www.yulianmf.com rully@yulianmf.com
Overview • Expression • Operator • Operator Precedence • Operator Overloading
Expression • Kumpulan dari operand dan operator • Operand dapat berupa nilai literal, variabel, atau return value dari sebuah fungsi • Operator menspesifikasikan operasi yang dilakukan terhadap satu atau lebih operand
Operator • Arithmetic • +, -, *, /, \, Mod • String Concatenation • &, + • Assignment • =, +=, -=, *=, /=, &=, \=, ^= • Comparison • =, <, >, <=, >=, <> • Object • Is, IsNot, TypeOf, AddressOf, GetType • Logical • And, AndAlso, Or, OrElse, Not
Operator Precedence • Urutan operator yang di proses dalam sebuah expression • Gunakan tanda kurung () untuk menghindari kesalahan perhitungan • Urutan operator yang di proses : • ^ • - (Negasi) • *, / • \ (Pembagian Integer) • +, - • & (String Concatenation)
Operator Overloading • Bekerja pada Reference Type • Two Objects Added? Multiplied? Compared? • Harus dideklarasikan dengan Shared keyword • Public Shared [otherModifiers] Operator operatorSymbol _ (ByVal operand1 As dataType[, ByVal operand2 As dataType]) _ As returnDataType ' ----- Code Statement End Operator