locked
change object property RRS feed

  • Question

  • Hi, I am trying to add new property to an object. Since I can not modify directly, what else I can do ?  For example:  Appointment object, it has startdate, enddate, subject, description, each property is linked to database table. Now I want to add owner to the property. Please note owner is also a colmun in the table. How could I do that ? 
    Thursday, October 18, 2012 8:34 PM

Answers

  • Objects are instances of a class. The class definition includes declaration of the properties that will be present in an object of that class.

    So, if you need an additional property in an Appointment object, you need to modify the class definition to add the new property, Owner. Note that if you do this, all Appointment objects will have the new Owner property once the class definition is changed.

    If modification to the class definition is unacceptable, you have the option of deriving a new class as a subclass of Appointment which includes the Owner property (perhaps called OwnedAppointment). Then only objects created from the new subclass will have the Owner property.

    • Proposed as answer by ANILKPILLAI Friday, October 19, 2012 5:21 AM
    • Marked as answer by sdnd2000 Friday, October 19, 2012 6:08 PM
    Thursday, October 18, 2012 9:42 PM