3 ! PR 41556: [OOP] Errors in applying operator/assignment to an abstract type
5 ! Contributed by Damian Rouson <damian@rouson.net>
7 module abstract_algebra
13 type ,abstract :: object
15 procedure(assign_interface) ,deferred :: assign
16 procedure(product_interface) ,deferred :: product
17 generic :: assignment(=) => assign
18 generic :: operator(*) => product
22 function product_interface(lhs,rhs) result(product)
24 class(object) ,intent(in) :: lhs
25 class(object) ,allocatable :: product
26 real ,intent(in) :: rhs
28 subroutine assign_interface(lhs,rhs)
30 class(object) ,intent(inout) :: lhs
31 class(object) ,intent(in) :: rhs
37 subroutine rescale(operand,scale)
38 class(object) :: operand
39 real ,intent(in) :: scale
40 operand = operand*scale
41 operand = operand%product(scale)