Yes Raghupathi,

That you can check when you have computer in hand. What if this question is
asked in interview (without machine)?
Thanks,

Suriya

On Mon, Jun 14, 2010 at 5:51 PM, Raghupathi Kamuni <[email protected]>wrote:

> *If keyword is abstract, it would never compile.*
> Error message will be "Cannot call an abstract base member: 'A.method1()'"
>
> *Code for Abstract method*
> =====================
> using System;
> abstract class A
> {
>      public abstract void method1();
> }
> class B:A
> {
>  public override void method1()
>  {
>       base.method1();
>      Console.WriteLine("B-->method1");
>  }
> }
>
> class MainClass
> {
>   public static void Main()
>   {
>  B b = new B();
>  b.method1();
>   }
> }
>
>
> *Code for Virtual method*
> ===================
> using System;
> class A
> {
>      public virtual void method1(){}
> }
> class B:A
> {
>  public override void method1()
>  {
>   base.method1();
>   Console.WriteLine("B-->method1");
>  }
> }
>
> class MainClass
> {
>   public static void Main()
>   {
>  B b = new B();
>  b.method1();
>   }
> }
>
>
>
> On Mon, Jun 14, 2010 at 10:22 AM, Akter Suriya <[email protected]>wrote:
>
>> One of my friend asked me this question.
>>
>> class A
>> {
>> XXX method1()
>> ......
>> }
>>
>>
>> class B : A
>> {
>> override method1 ()
>> {
>> base.method1();
>> }
>> }
>>
>> He says, how can we identify, XXX (written in front of method1 in class A)
>> is virtual or abstract.
>> Can anybody help me. Thanks.
>>
>> --
>> Suriya
>>
>>
>


--

Reply via email to