C# seal Functions and Classes

Description

We can stop overridding with seal keyword.

Example

Example for C# seal Functions and Classes


class Shape{// w  w  w  . j ava  2s.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;
      }
   }
}




















Home »
  C# Tutorial »
    Custom Types »




C# Class
C# Struct
C# Interface
C# Inheritance
C# Namespace
C# Object
C# Delegate
C# Lambda
C# Event
C# Enum
C# Attribute
C# Generics
C# Preprocessor