Can we create instance for Abstract class?
Answers were Sorted based on User's Feedback
Answer / vijay
we can not create an instance of abstrct class;because
abstract class have incomlete methods
| Is This Answer Correct ? | 20 Yes | 19 No |
Answer / deepakmodi
We can't create instance for Abstract class because its
methods are with out definitions. we can create an object
form derived class which we can use to call the methods
| Is This Answer Correct ? | 3 Yes | 2 No |
Answer / rupali
we cant make object of abstract class becoz, in the vtable the vtable entry for the abstract class functions will be NULL, which ever are defined as pure virtual functions...
even if there is a single pure virtual function in the class the class becomes as abstract class..
if there is a virtual function in your class the compiler automatically creates a table called virtual function table .. to store the virtual function addresses.... if the function is a pure virtual function the vtable entry for that function will be NULL.
even if there is a single NULL entry in the function table the compiler does not allow to create the object.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / lakshminarayana golla
hi manjitt can any body explain me about this below program?
it is executing successfully without any errors.
can u explain me what is the concept hide in this program
please.....
abstract class aa {
public abstract void main(String[] args);
}
class aaa {
public static void main(String[] args)throws Exception{
Object x = Class.forName("aaa").newInstance();
System.out.println(x);
}
}
| Is This Answer Correct ? | 2 Yes | 2 No |
Answer / lakshminarayana golla
we can create object in 4 ways to create an object:
1.Using 'new' operator.
2.Using class.forName( classname ).newInastance();
3.Using clone();
4.Using getInstance();
can anybody explain me what is the difference between those
above 4 things??
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / raghvendra
This is not at all related to this thread. here user
creating the object of class aaa which is not the abstract
object. abstract class is aa not aaa.
| Is This Answer Correct ? | 2 Yes | 2 No |
Answer / rajesh parab
you can create at least in java 5.
YourAbstractClass obj= new YourAbstractClass (){}
try this.
but if you have abstrace method in it then you can not
create.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / d
we can create instance for abstract class through dynamic binding concept.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is the benefit of interface in c#?
What is an extension method in c#?
1. What is lazy loading? 2. What is delay signing? 3. How to transfer view object to presenter in MVP? 4. How to create a generic class? 5. What is Ajax object? 6. What is explicit interface implementation? 7. I1, I2 interfaces have same methods (say PrintName) explicitly implemented in class C1. Now how to call PrintName method from I1? 8. I have a list of Customers. List the customer with maximum orders using LINQ.
What is extension method in c# and how to use them?
How does yield return work c#?
Does c# support multiple class inheritance?
What is GAC?
Why do I get a security exception when I try to run my c# app?
Is c# used for any core features of windows vista?
What are different properties provided by Object-oriented systems?
Why are strings immutable in c#?
What are the return types in c#?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)