C# seal Functions and Classes

In this chapter you will learn:

  1. What
  2. Example for C# seal Functions and Classes

Description

We can stop overridding with seal keyword.

Example

Example for C# seal Functions and Classes


class Shape{/*from  w w w .java2  s  . c  o m*/
  public virtual int Area{
     get{
        return 0;
     }
  }
}

class Rectangle:Shape{
   public int width;
   public int height;
   
   public sealed override int Area{
      get{
         return width * height;
      }
   }
}

Next chapter...

What you will learn in the next chapter:

  1. What are Abstract Classes and Abstract Members
  2. Syntax for C# Abstract Classes and Abstract Members
  3. Example for Abstract Classes and Abstract Members
Home »
  C# Tutorial »
    C# Types »
      C# Inheritance
C# Class Inheritance
C# base Keyword
C# seal Functions and Classes
C# Abstract Classes and Abstract Members
C# Polymorphism
C# Virtual Function Members
C# Override methods
C# Shadow inherited members
C# as operator
C# is operator