Overloading, Abstract Classes, and Inheritance
Overloading, Abstract Classes, and Inheritance
This means you are free to copy and redistribute the material and adapt and build on the material
under the following terms: You must give appropriate credit, provide a link to the license and
indicate if changes were made. If you adapt or build on the material you must distribute your work
under the same license as the original.
Note that this presentation may contain images owned by others. Please seek their permission
before reusing these images.
Overloading
• Recall that generic interfaces can enable procedure overloading:
module maths_functions
interface my_sum
module procedure real_sum
module procedure int_sum
end interface
contains
function real_sum (a, b)
implicit none
real, intent(in) :: a,b
real_sum = a + b
end function real_sum
write(*,*) bob%getName()
write(*,*) bob%person%getName()
write(*,*) fred%getName()
call bob%movePerson(fred,35)
call fred%movePerson(bob,46)
Abstract classes
• Can define abstract classes and deferred procedures
• Define data
• Define procedures and interfaces
• Define implement procedures
• Define procedures to be implement by further classes