Can interface be not abstract?

Friend of mine said that not every interface is abstract. I haven’t chance to discuss that with him but it get me thinking of not abstract interface in any type of language.

Is there a non abstract interfaces?

6

Simple answer to your question : No, your friend is wrong.

An interface provides no implementation of the methods it defines. Would it make sense if we could instantiate one of those? Of course not. Interfaces are only that, an abstraction.

This is obviously assuming that when you say interface, you think about the interface language feature as defined by C#, Java, C++, etc with the interface keyword. In the case your friend means an API interface, then the question does not really make sense to me. APIs may allow you to extend functionality through subclassing or by adhering to a particular contract as defined by an interface or an existing class of the system.

3

Yes.

The idea of an interface (ie, a description of facilities provided and their semantics) is inherently abstract.

However, the question appears to confuse this with the mechanism by which such an interface (small i) may be reified into certain languages which provide an Interface (big i) for this purpose.

Further, there is anyway more than one thing you may wish abstract:

  • polymorphism: you wish to hide multiple different types or behaviours behind a description of the things they have in common. In this case, the interface should be probably abstract
  • implementation: you wish to hide the details of a complex system behind a unifying abstraction. In this case there may never be more than one implementation, so the interface can itself be concrete

4

Depends much on what meaning your friend gave to the word interface.

Interface as the concept of an abstract contract on methods/properties


So this means the Interface types provided by diverse languages (like the
cited above: C#, Object Pascal (Delphi or FPC), Java, etc) so the answer is no.

In this case, the Interface is an contract on methods – without any form of implementation.

Interface as a contract on the description of facilities provided and their semantics


In this case, even an non-pure abstract class can be considered an interface. In this case, the designer even have how to implement default basic behavior (like throwing exceptions on non-implemented virtual methods which are not abstract) on that base class.

So, if it is the case, so yes those “interfaces” can be not abstract.

No.

Interface from simple definition is abstraction of API that class can implement. If it is not abstract, then it is not an interface.

1

Interfaces need not be abstract. Example:

class Foo {
public:
    void printHello () {
         printf("Hello");
    }
};

Here Foo is a concrete class with an interface printHello(). Foo is not abstract.

All above answers are correct. But this is how I understand it.

Interface are just definitions of service. E.g. You need to book a ticket for an air travel. Its an idea/concept that you ‘book a ticket’. And not worry about how it is done physically.

A Class that implements it will define how it is done and what physical form it takes.

E.g. An Interface could be to book a ticket. You could then have various entities that provide you this service. A travel agent, online booking, or actual airline office.
They all provide the service (Interface) to book a ticket.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật