Click here to Skip to main content
15,885,852 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
The code is as follows:

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace InplicitWithAbstract
{
    class Program
    {
        static void Main(string[] args)
        {
            B b = new B();
            int r2=b.m2(8,2);
            Console.WriteLine(r2);
            A a = b; //UPCASTING
            int r1=a.m1(4,7);
            Console.WriteLine(r1);

            Console.ReadLine();
        }
    }

        public abstract interface I1
        {
            int m1(int x, int y);
            abstract int m2(int a, int b);
        }


    public abstract class A : I1
    {
        public int m1(int x, int y)
        {
            return x + y;
        }
    }
    public class B : A
    {
        public override int m2(int a, int b)
        {
            return a - b;
        }
    }
}
Posted

You cannot. Even if it was allowed by C# syntax, it would make no sense at all. If you will, all interfaces are "abstract by definitions".

For some ideas, please see my past answers and answers referenced in these two:
Why we need to create instance for interface not for implementation?[^],
Doubts on Interfaces[^].

It's many answers altogether, and, sorry, some points are repeated, but you better look through these answers, they can really help you to understand things.

—SA
 
Share this answer
 
v2
An abstract interface would make no sense. There are no properties an abstract interface would have that a non-abstract interface wouldn't so the abstract keyword is redundant, it is just an interface.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900