|
| Total Answers and Comments: 5 |
Last Update: March 04, 2009 Asked by: v k kumar |
|
| | |
|
Submitted by: Gaurav
This is not working. Following is the code: using System;using System.Collections.Generic;using System.Text;namespace ConsoleApplication2{ public abstract class sayhello{ public void hello(){ Console.WriteLine("hello");} } class Program{ static void Main(string[] args){ Object o=System.Activator.CreateInstance(typeof(sayhello));(( sayhello)o).hello();} } } Please clarify..
Above answer was rated as good by the following members: yunuskhan | |
June 28, 2006 05:14:03 | #1 |
| Ashishtandon.e |
|
Member Since: March 2006 Contribution: 14 |
RE: Can u create the instance for abstract classes
| no we cannot instanciate abstract class we hav to extend it first ex- abstract class A {} class B : A {} Class C { B b new B; } |  | | Is this answer useful? Yes | No | | |
|
| |
|
September 26, 2006 07:11:57 | #4 |
| Gaurav |
|
|
RE: Can u create the instance for abstract classes
| This is not working. Following is the code: using System;using System.Collections.Generic;using System.Text;namespace ConsoleApplication2{ public abstract class sayhello{ public void hello(){ Console.WriteLine( hello );} } class Program{ static void Main(string[] args){ Object o System.Activator.CreateInstance(typeof(sayhello));(( sayhello)o).hello();} } } Please clarify.. |  | | Is this answer useful? Yes | No | 1 0 | Overall Rating: +1 |
|
| |
Go To Top
|