Re: Adding member property to abstract class
From: C.E.O. Gargantua (usb_at_cord.blah)
Date: 01/20/05
- Next message: C. Adam Barney: "Making my own command prompt"
- Previous message: Jay B. Harlow [MVP - Outlook]: "Re: Exception management question..."
- In reply to: CEO Gargantua: "Re: Adding member property to abstract class"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 20 Jan 2005 15:00:54 -0800
Ok, just ignore me.
The answer is "yes, of course".
I just had the wrong syntax when I added the field ( I must have been
dead tired, I didn't add a datatype to it LOL of course it thew an
error, and because I'm new to abstract classes, I /assumed/ that they
were the problem !?! ).
CEO Gargantua wrote:
>
> The code that I'm working on isn't much difference from what I posted,
> because I hit a road block with trying to add a property to an abstract
> class...and that's the problem I am posting about.
>
> > The code that you've posted has various potential problems in - there
> > are no properties at all, you're trying to return void, and you're not
> > actually implementing the method in the interface.
>
> Well, the implementation is taken care of by the abstract class...that
> is, its methods act as defaults that handle the requirements of the
> interface. Then I can override them using polymorphism for individual
> classes that implement the abstract.
>
> Jon Skeet [C# MVP] wrote:
>
>> C.E.O. Gargantua <usb@cord.blah> wrote:
>>
>>> I want to have a member property that is common to a set of classes.
>>>
>>> I designed an abstract class, but when I try to add it to the
>>> abstract class, it flags an error in VS.NET.
>>>
>>> The design ( summarized is like this ) :
>>>
>>>
>>> interface interfaceA {
>>> string myMeth();
>>> }
>>>
>>> public class abstract ClassA{
>>>
>>>
>>> // string _myStrValue; // This is what I want to add, but
>>> // the syntax doesn't fit...why?
>>>
>>> string myMethod()
>>> {
>>> return void;
>>> }
>>> }
>>>
>>> public class myDerivedClassA : ClassA, interfaceA
>>>
>>> {
>>>
>>>
>>> }
>>
>>
>>
>> Could you post a short but complete program which demonstrates the
>> problem?
>>
>> See http://www.pobox.com/~skeet/csharp/complete.html for details of
>> what I mean by that.
>>
>
>>
>
>
-- Texeme http://texeme.com incognito () Updated Almost Daily http://kentpsychedelic.blogspot.com
- Next message: C. Adam Barney: "Making my own command prompt"
- Previous message: Jay B. Harlow [MVP - Outlook]: "Re: Exception management question..."
- In reply to: CEO Gargantua: "Re: Adding member property to abstract class"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|