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


Please Help Members By Posting Answers For Below Questions

What is c# commonly used for?

642


What is session and cookies in c#?

727


What is the difference between virtual and override in c#?

715


What is data set in c#?

714


What is the difference between a field and a property in c#?

685


Explain the difference between class and interface in .net?

639


Why is aws serverless?

673


What is the meaning of MSIL?

842


What is arraylist c#?

640


How to use session under class file of APP_Code folder?

709


What is the difference between dynamic type variables and object type variables in c#?

683


Define satellite Assembly in .NET?

750


How long can a string be c#?

666


Explain the concepts of cts and cls(common language specification).

729


What is deadlock in c#?

661