mkkl

mkkl

  • NA
  • 1
  • 0

Copy members of a Parent object to a Child object

Dec 15 2004 2:08 PM
Wondering if there is a easy way in C# that provides copying members of a parent to a child without explicitly coding the copy of each members? This is what I would like to do... public class Person { int age = 0; } public class Manager { } class Test { [STAThread] static void Main(string[] args) { Person p = new Person(); Manager m = new Manager(); p.age = 30; // I know this will not work... but what I wanted to do is to copy the common // denomiated members from parent to child... is there a way without coding // copying of each members? m = p; } }

Answers (1)