Re: C# inheritance broken?
- From: Andre Kaufmann <andre.kaufmann_re_move_@xxxxxxxxxxx>
- Date: Tue, 30 Jan 2007 21:48:57 +0100
Mike Schilling wrote:
<groups@xxxxxxxxxxxxx> wrote in message news:1170084841.336327.226140@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[...]
But you haven't shown a C++ solution either, since the cast in your example doesn't work.
If a constructor is added like in the following example, it will work. Think that was the intention of Tony.
class Document
{
public:
Document(){}
static Document Load() { return Document(); }
};
class MyDocument : public Document
{
public:
MyDocument() {}
MyDocument(Document& s) : Document(s) {}
static MyDocument Load() { return Document::Load(); }
};
int main(int argc, char* argv[])
{
MyDocument s = MyDocument::Load();
return 0;
}
Andre
.
- Follow-Ups:
- Re: C# inheritance broken?
- From: Bruce Wood
- Re: C# inheritance broken?
- From: groups
- Re: C# inheritance broken?
- References:
- C# inheritance broken?
- From: groups
- Re: C# inheritance broken?
- From: Ignacio Machin \( .NET/ C# MVP \)
- Re: C# inheritance broken?
- From: groups
- Re: C# inheritance broken?
- From: Mythran
- Re: C# inheritance broken?
- From: Ignacio Machin \( .NET/ C# MVP \)
- Re: C# inheritance broken?
- From: Michael D. Ober
- Re: C# inheritance broken?
- From: Ignacio Machin \( .NET/ C# MVP \)
- Re: C# inheritance broken?
- From: groups
- Re: C# inheritance broken?
- From: Mike Schilling
- C# inheritance broken?
- Prev by Date: Does typeof or is work when dealing with an interface?
- Next by Date: Inserting class collection data into Access database
- Previous by thread: Re: C# inheritance broken?
- Next by thread: Re: C# inheritance broken?
- Index(es):
Relevant Pages
|