Re: inheritance conundrum
Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance
I presume the A contains a Person member? If there is a setter for this,
just call it from C's constructor. Something like:
public C()
{
SetPerson(Person.Paul) ;
}
If there is no method to change the Person part of A, then you are out
of luck.
Bob
"bill tie" <billtie@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:5F8EC512-7BA9-46FD-87AD-A673BD022E54@xxxxxxxxxxxxxxxx
Consider the following classes A and B.
public class A
{
public enum Person
{
Peter = 0,
Paul = 1
}
public A(Person name)
{
}
}
public class B : A
{
public B() : base(Person.Peter)
{
}
}
public class C : B
{
// ????
}
- A and B are black boxes. I've no way of altering their code.
- I write the C class. I want my C class to have all the capabilities of
the B class except for the enumeration "Person.Peter". I want
"Person.Paul".
Is this possible? How should I define the C class?
Thank you.
.
Relevant Pages
- Re: Shared classes or modules?
... initialization code that is executed the very first time you use any member ... I could have the Sub New above open the log file the first time I went ... Other posts say that a module have no default constructor but it can ... >> Also you should make the constructor private, to prevent instantiating ... (microsoft.public.dotnet.languages.vb) - Re: C++ 101 dumb question
... Its action is to copy the data members of the class, ... If one of those members is a pointer, ... have it's own copy constructor would the default copy constructor call ... as a copy of the class being returned is placed on the stack for the ... (microsoft.public.vc.language) - Re: Error using ==> class
... The argv in there is obviously a holdover. ... varargin because varargin apparently does not actually allow nargin == ... the change, no changes to code are made, and the constructor (as seen ... All instances of an object must have the same member names in the same ... (comp.soft-sys.matlab) - Re: ECMAScript standard:the code(s) for figure on page 3 ?
... You need to assign that object to the public prototype property of the ... assigned a reference to the empty anonymous function on the right hand ... Instance have property from constructor. ... member create from scope of constructor function. ... (comp.lang.javascript) - Re: composition/aggregation: would like to use constructor body rather than initializer list
... "constructor chaining" takes in C++; this type of mechanism is essential ... and ubiquitous (whether you're dealing with pointers or not) across all OO ... >the constructor or get some non-trivial input info, before building member ... The contemporary wisdom in C++ as it applies to initialization lists is ... (alt.comp.lang.learn.c-cpp) |
|