EN VI

What is Interface?

In Object Oriented Programming, an Interface is a description of all functions that an object must have in order to be an "X". Again, as an example, anything that "ACTS LIKE" a light, should have a turn_on() method and a turn_off() method. The purpose of interfaces is to allow the computer to enforce these properties and to know that an object of TYPE T (whatever the interface is ) must have functions called X,Y,Z, etc.

An interface is a programming structure/syntax that allows the computer to enforce certain properties on an object (class). For example, say we have a car class and a scooter class and a truck class. Each of these three classes should have a start_engine() action. How the "engine is started" for each vehicle is left to each particular class, but the fact that they must have a start_engine action is the domain of the interface.
Posts (1)
Questions (2)
2024-03-14 13:00:11
A good reference for this would be to review how the standard library is implemented. It's doubtful you're going to find a "better" way to do things than they do. I you consider set.mli and set.ml you...
Tags: Interface ocaml signature
2024-03-15 20:30:09
Going by common sense, your structure is incorrect. The nutritional elements are carbs, fats, proteins, probably other stuff I am not aware of. It seems you should have classes representing each of th...
Tags: java Class Interface

Login


Forgot Your Password?

Create Account


Lost your password? Please enter your email address. You will receive a link to create a new password.

Reset Password

Back to login