A
Andrea Williams
I have two objects and one inherits the other and adds a few more
properties. Say I populate the first object with the properties, then want
to cast it to be the second object, then I would be able to add the extra
propety value proerties and save the data based on the new object.
Example:
Object one has these properties:
FirstName
LastName
Object two inherits from Object one and adds these properties:
MiddleInitial
Title
So I create object one, fill it using a database query from a particular
table. then I want to be able to cast it to object two, add the extra
properties and save it to a different table in the database. Currently, I'm
just doing this:
object2.FirstName = object1.FirstName;
object2.LastName = object1.LastName;
But is there a way that I could implement an interface or something that
would let me cast the object1 to object2?
Any articles about this.
Thanks in advance,
Andrea Williams
properties. Say I populate the first object with the properties, then want
to cast it to be the second object, then I would be able to add the extra
propety value proerties and save the data based on the new object.
Example:
Object one has these properties:
FirstName
LastName
Object two inherits from Object one and adds these properties:
MiddleInitial
Title
So I create object one, fill it using a database query from a particular
table. then I want to be able to cast it to object two, add the extra
properties and save it to a different table in the database. Currently, I'm
just doing this:
object2.FirstName = object1.FirstName;
object2.LastName = object1.LastName;
But is there a way that I could implement an interface or something that
would let me cast the object1 to object2?
Any articles about this.
Thanks in advance,
Andrea Williams