List Info

Thread: C-Sharp (C#) Group: Generics contstraint new() and abstract class inheritance




C-Sharp (C#) Group: Generics contstraint new() and abstract class inheritance
user name
2006-07-26 20:14:36
Hi,

Rather strange error I am unable to solve.

I have an abstract class IRedBlackNode<T> which is
part of (whatever it
is called) an interface IRedBlackTree<T, S> where S is
an
IRedBlackNode<T>

I am getting errors like:

/*
*****
Error	3	The type
'FiniteAutomaton.structs.IRedBlackNode<T>' must have
a
public parameterless constructor in order to use it as
parameter
'_RedBlackNode' in the generic type or method
'FiniteAutomaton.structs.RedBlackTree<T,_RedBlackNode>
;'
*****
*/



Some code is below:
----------------------------------------

public abstract class IRedBlackNode<T>
     where T : IComparable<T>
    {
        ........................

        public IRedBlackNode()
        {
            // DO NOTHING!
        }
    }

public interface IRedBlackTree<T, S>
        where T : IComparable<T>
        where S : IRedBlackNode<T>, new()
    {
        void Initialize(T Value, IRedBlackNode<T>
Node);
        void Insert(T Value);
        event d_OnTreeUpdated_Delegate<T>
OnTreeUpdated;
    }

public class RedBlackTree<T, _RedBlackNode> :
IRedBlackTree<T,
_RedBlackNode>
        where T:IComparable<T>
        where _RedBlackNode: IRedBlackNode<T>, new()
    {

.........................
}

-------------------------------------

The abstract class IRedBlackNode<T> has a non-abstract
parameterless
constructor - so I don't see what the problem is.

Many thanks for your kind help.
Vladimir Lushnikov


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "C-Sharp (C#)" group.
To post to this group, send email to C_Sharpgooglegroups.com
To unsubscribe from this group, send email to
C_Sharp-unsubscribegooglegroups.com
For more options, visit this group at http://groups.
google.com/group/C_Sharp
-~----------~----~----~----~------~----~------~--~---

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )