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
Are c# destructors the same as c++ destructors?
Write a console application and implement the ternary operator to decide whether the age a user entered after being prompted is allowed to vote or not(given that only citizens between 18 and 120 years only inclusive can vote). Use exception handling for non-numerical input.
What is iqueryable?
What is primitive types in c#?
Why do we use reflection in c#?
What are "class access modifiers" in C#?
C# called c sharp why?
What are PE(Portable Executable)?
Explain polymorphism in c# with a simple example?
What is executescalar in c#?
How many types of delegates are there in c#?
Define delay signing?
Why do we use class in c#?
Explain the difference between a namespace and assembly name in .net?
Do loops in c#?