Jump to content

Sealed classes and methods: Difference between revisions

Added C
(Added Go)
(Added C)
Line 21:
* [[Inheritance/Single]]
* [[Inheritance/Multiple]]
 
=={{header|C}}==
C isn't an object oriented language though it can and has been used to create other languages which are.
 
It has structs rather than classes which are just a collection of fields. Methods on a struct can be simulated by functions whose first argument is a pointer to the struct.
 
However, there is no way to simulate inheritance of one struct by another. A struct can contain a field of another struct type but this is not the same as 'struct embedding' in the Go language.
 
So, for the purposes of this task, we can say that structs and simulated methods in C are by their nature always sealed.
 
=={{header|FreeBASIC}}==
9,492

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.