Can we create instance for Abstract class?
Answer Posted / anand kumar dwivedi (bholu)
we can't create instance for an abstract class directly, but
with the help of DYNAMIC BINDING(in this case we can put the
ref. of parent class) we can create the object of abstract
class.
an example;
abstract class Temp
{
abstract void show();
void display()
{
System.out.println("possible to create");
}
}
class TestTemp extends Temp
{
void show()
{
System.out.println("we are providing body for abstract method");
}
public static void main(String[] args)
{
Temp temp = new TestTemp();
temp.show();
temp.display();
}
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What Happens In Memory When You Box And Unbox A Value-type?
What operator means?
Why we use dll in c#?
Where is the keyword void used?
What is the difference between field and property in c#?
Is comparator a functional interface?
How does the lifecycle of Windows services differ from Standard EXE?
Why do we use threads in c#?
What is the components of window?
Explain the difference between pass by value and pass by reference.
What is dictionary collection in c#?
What is difference between array and collection?
why delegate is type safe?
What is call back method?
What is a collection in c#?