C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Difference b/w Abstract Class V/s Interface, and Structure V/s Class
WhatsApp
Munesh Sharma
11y
6.4
k
0
0
25
Blog
Abstract Class V/s Interface
An Abstract class can have implementation for some of its methods. But, the interface can't have implementations for any of its methods
An Abstract class can have fields but the interface does not have fields
An Interface can inherit from another interface, but, can't inherit from another abstract class; but an abstract class can inherit from another abstract class and another interface
The Abstract class members can have access modifiers, whereas, the interface member doesn't have access modifiers
Structure V/s Class
A Class is a reference type, so it is stored in a Heap. Structure is a value type, so it is stored in a stack
A Class has inheritance, but a structure does not have
inheritance
In a Class, there is a constructor. But in a structure, there may or may not be a constructor
By default, a Class has a private access modifier and a structure has a public modifier
Difference b/w Abstract Class V/s Interface
Up Next
In What Scenarios Will You Use Abstract Class vs Interface
Ebook Download
View all
Working with Directories in C#
Read by 17.6k people
Download Now!
Learn
View all
Membership not found