---
title: 不建议使用参数化派生扩展类型的多态化
description: "不建议使用参数化派生扩展类型的多态化，在某些情况下这可能会出现问题。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengdevkithistory/bisheng/hist-bisheng/kunpengbisheng_06_0081_0.html
sourcePath: /source/zh/kunpengdevkithistory/bisheng/hist-bisheng/kunpengbisheng_06_0081_0.html
indexId: cc3746390ce57ef1dff6470fabb0f7f1ae280fb056cb8c4b5ad8189101c9a2b582
---
# 不建议使用参数化派生扩展类型的多态化

不建议使用参数化派生扩展类型的多态化，在某些情况下这可能会出现问题。

如：

```
module test
    implicit none
    type :: ty(a, b)
        integer, len :: a, b
        real(4) :: r1(b)
    end type
    type, extends (ty) :: ty1(c)
        Integer, len :: c
        real(4) :: r2(c)
    end type
end module
 
program main
    use test
    implicit none
    type (ty1(:, :, :)), allocatable :: x
    allocate (ty1(3, 2, 20) :: x)
    x%r1 = 1.0
    x%r2 = 2.0
end program
```
