On Thu, 02 Oct 2008 15:08:02 -0700, amir <am**@discussions.microsoft.com>
wrote:
[...]
I am trying to do the above but I am getting errors. I want to create
Object
C only if the boolean is true and not create it otherwise. How can I go
about
doing this?
Next, please remember to be _specific_ about your question. For example,
you write "but I am getting errors". What errors? Where? Under what
circumstances? When you compile? When you run the application?
It's also helpful if you actually post code that compiles. As opposed to
code that has a method named "constructorObjectC" that illegally tries to
call a base constructor.
That said, my mind-reading hat seems to be working okay today, and I can
explain to you that at a minimum you have an illegal call to the base
constructor in ObjectC, because ObjectB only has a two-argument
constructor and you're trying to call a single-argument constructor.
Furthermore, if you posted the exact code that you compiled then obviously
you will want to fix your constructor so that it's named "ObjectC" instead
of "constructorObjectC". In that case, you also will want to add an
accessibility modifier to the constructors so that they aren't private.
Which of these mistakes actually applies to the foremost problem you're
running into I can't say because you haven't shared enough information
about the errors. But hopefully the code you posted is close enough to
the code you're actually trying to compile that the above is in some way
helpful.
Pete