# Newbie looking for advice

**URL:** <https://fortran-lang.discourse.group/t/newbie-looking-for-advice/8381>\
**Category:** Help\
**Created:** [July 24, 2024, 12:44am UTC](https://fortran-lang.discourse.group/t/newbie-looking-for-advice/8381 "2024-07-24T00:44:37Z")\
**Posts on this page:** 1\
**Showing post:** 18

<div class="post-metadata">

**Author:** ![jwmwalrus](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/jwmwalrus/32/4483_2.png) [@jwmwalrus](https://fortran-lang.discourse.group/u/jwmwalrus)\
**Post date:** [July 25, 2024, 1:22am UTC](https://fortran-lang.discourse.group/t/newbie-looking-for-advice/8381/18 "2024-07-25T01:22:01Z")

</div>

Operator overloading was a Fortran 90 thing, and the OOP facilities were added in Fortran 2003, so you have two ways to do the same thing, e.g.:

```fortran
....
    type, public :: qobj
        complex(real64), allocatable :: data(:,:)
    contains
        procedure, private :: mult_matrix, mult_scalar1, mult_scalar2
        generic :: operator(*) => mult_matrix, mult_scalar1, mult_scalar2
        procedure, private :: write_qobj
        generic :: write(formatted) => write_qobj
    end type
...
contains
....
    subroutine write_qobj(this, unit, iotype, v_list, iostat, iomsg)
        class(qobj), intent(in) :: this
        integer, intent(in) :: unit
        character(*), intent(in) :: iotype
        integer, intent(in) :: v_list(:)
        integer, intent(out) :: iostat
        character(*), intent(inout) :: iomsg
        ....
    end subroutine

```

In Fortran, _type-bound procedure_ is the fancy way of saying _method_ (i.e., passed object or receiver marked with `class`, dynamic dispatch, etc.).

[This post](https://fortran-lang.discourse.group/t/tutorials-on-object-oriented-programming-in-fortran/3052) lists some interesting stuff related to OOP in Fortran.

---

_[View the full topic](https://fortran-lang.discourse.group/t/newbie-looking-for-advice/8381)._
