Results 1 to 2 of 2

Thread: Creating rules for adding/subtracting 2 structures

  1. #1

    Thread Starter
    Lively Member Luc L.'s Avatar
    Join Date
    Jan 2005
    Posts
    122

    Post Creating rules for adding/subtracting 2 structures

    Ok, I have a structure

    Public Structure someStructure
    Dim settingName As String
    Dim settingValue As Integer
    End Structure

    Dim T1 as someStructure
    Dim T2 as someStructure

    now i want to call T1+T2 and obviously only add up the settingValue part of structure which is an integer.

    i know there is a way to define how the + operator is used in C++, and I'm wondering if there is a fairly simple way to do it in VB.net. I can obviously write a simple function to add them together, but if there was a way to overwrite the + operation on that it would be sexy and clean at the same time. sorry, but i'm a .net newbie

    Luc L.

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339

    Re: Creating rules for adding/subtracting 2 structures

    Operator Overloading isn't supported until 2005. The closest thing you can do is make a function to do the work then call it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width