
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
What is the difference between an interface and a class in C#?
An interface is a class without fields or method implementation. It cannot implement the methods it defines.
A class generally implements the methods defined in an interface.
Interface
Interfaces define properties, methods, and events, which are the members of the interface. Interfaces contain only the declaration of the members. It is the responsibility of the deriving class to define the members.
public interface interface_name { // interface_members }
Class
Class is a blueprint for a data type. This does not actually define any data, but it does define what the class name means. That is, what an object of the class consists of and what operations can be performed on that object.
class class_name { // class_members }
- Related Articles
- What is the difference between an interface and an abstract class in C#?
- Difference between Abstract Class and Interface in C#
- Difference between Abstract Class and Interface in C# Program
- Difference Between Interface and Abstract Class in Java & C#
- What is the difference between a class and an object in C#?
- Difference Between Class and Interface in Java
- Difference between abstract class and interface
- What are the differences between a class and an interface in Java?
- Difference between Abstract Class and Interface in Java
- Difference Between Thread Class and Runnable Interface in Java
- What is the difference between Enumeration interface and enum in Java?
- What are the differences between an event listener interface and an event adapter class in Java?
- What is the difference between abstract class and a concrete class in Java?
- What is the difference between Static class and Singleton instance in C#?
- Difference between IComparable and IComparer Interface in C#

Advertisements