I have a simple scenario. I’d like to create a new instance of the class below.
class A implements Fancy {
void my() {
Fancy b = // new X(); where X could be A or B
}
}
When you have a B which implements Fancy as well.
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.
Create an
abstract class AbstractFancywith acreatemethod:In each class implement the
createmethod: