G
Guest
Hi,
I have Class A, and I would like my Class B to inherit from Class A because they are conceptually common classes. My problem is that Class A has a property that I don't want Class B to have. Is there any way to hide, or not inherit, properties of the parent class? Btw, I'm coding in C#, in case that makes a difference.
My intuition says this isn't possible (and probably not desireable from the clarity point of view), but I'm not sure.
Many thanks!
ps. Here's some pseudo-code:
public class MyClassA
{
public MyClassA();
public PropX { get; set; }
public PropY { get; set; }
public PropZ { get; set; }
}
public class MyClassB : MyClassA
{
public MyClassB();
public PropW { get; set; }
public PropQ { get; set; }
// but I don't want this class to inherit PropZ from MyClassA
}
I have Class A, and I would like my Class B to inherit from Class A because they are conceptually common classes. My problem is that Class A has a property that I don't want Class B to have. Is there any way to hide, or not inherit, properties of the parent class? Btw, I'm coding in C#, in case that makes a difference.
My intuition says this isn't possible (and probably not desireable from the clarity point of view), but I'm not sure.
Many thanks!
ps. Here's some pseudo-code:
public class MyClassA
{
public MyClassA();
public PropX { get; set; }
public PropY { get; set; }
public PropZ { get; set; }
}
public class MyClassB : MyClassA
{
public MyClassB();
public PropW { get; set; }
public PropQ { get; set; }
// but I don't want this class to inherit PropZ from MyClassA
}