I can’t figure out the use for this code. Of what use is this pattern?
[code repeated here for posterity]
public class Turtle<T> where T : Turtle<T>
{
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This pattern essentially allows you to refer to a concrete subclass within the parent class.
For example:
Versus:
In the former, it’s specified that a
SeaTurtle‘s baby will be aSeaTurtle.