

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Abstract vs Sealed Classes vs Class Members in C#
The abstract class includes abstract and non-abstract methods. You cannot instantiate an abstract class.
The sealed class prevents inheritance and you cannot use it as a base class.
Abstract Classes
To declare an abstract class, you need to place the keyword abstract before the class definition. An example of class members in an abstract class can be the following that defines an abstract method −
public abstract class Vehicle { public abstract void display(); }
The abstract method definition is followed by a semi-colon since it has no implementation.
Sealed Classes
To declare a sealed class, you need to place the keyword sealed before the class definition. The sealed class prevents inheritance and you cannot use it as a base class.
public sealed class Test { // Class members comes here }
- Related Questions & Answers
- Virtual vs Sealed vs New vs Abstract in C#
- Classes vs Structures in C#
- Structure vs class in C++
- Explain Inheritance vs Instantiation for Python classes.
- Debug Class vs Debugger Class in C#
- C/C++ Struct vs Class
- Abstract Classes in Java
- Abstract Classes in C#
- OneDrive vs Dropbox vs Google Drive vs Box
- Class method vs static method in Python
- Functional Components Vs. Class Components in ReactJS
- mysql_fetch_array vs mysql_fetch_assoc vs mysql_fetch_object?
- Corona vs. Phonegap vs. Titanium
- C++ vs Java vs Python?
- Abstract Classes in Dart Programming
Advertisements