N
News.microsoft.com
I have a service on which I can make a request that returns an object of
type Person (for example). I would like to add some additional properties
to this class without modifing the Person class. At first I thought
inheritance but I am receiving an instance of the Person object. I could
use a wrapper class and assign the person instance to a property in the
wrapper class but then I would have to re-write each property in the person
class to expose it in the wrapper class. Is there a way to create a new
object that over-classes (if you will) an instance of another class.
Example:
Person Class < I get an instance of this class from the service I call
FirstName
LastName
NewPerson Class < I want to add the FullName property to it
FirstName (inherted from Person)
LastName (inherted from Persion)
FullName = FirstName & LastName
type Person (for example). I would like to add some additional properties
to this class without modifing the Person class. At first I thought
inheritance but I am receiving an instance of the Person object. I could
use a wrapper class and assign the person instance to a property in the
wrapper class but then I would have to re-write each property in the person
class to expose it in the wrapper class. Is there a way to create a new
object that over-classes (if you will) an instance of another class.
Example:
Person Class < I get an instance of this class from the service I call
FirstName
LastName
NewPerson Class < I want to add the FullName property to it
FirstName (inherted from Person)
LastName (inherted from Persion)
FullName = FirstName & LastName