Realization indicates that a class implements the features of an interface. It is often used in cases where a class realizes the operations defined by an interface.
The notation for realization is a dashed line with a hollow triangle pointing toward the interface, showing that the class depends on the interface but commits to implementing it.
Unlike generalization, which implies an "is-a" relationship between a base class and its subtypes, realization emphasizes an “implements” relationship where the interface defines capability and the class fulfills it.
Let's consider the scenario where a "Person" and a "Corporation" both realizing an "Owner" interface.
- Owner Interface: This interface now includes methods such as "acquire(property)" and "dispose(property)" to represent actions related to acquiring and disposing of property.
- Person Class (Realization): The Person class implements the Owner interface, providing concrete implementations for the "acquire(property)" and "dispose(property)" methods. For instance, a person can acquire ownership of a house or dispose of a car.
- Corporation Class (Realization): Similarly, the Corporation class also implements the Owner interface, offering specific implementations for the "acquire(property)" and "dispose(property)" methods. For example, a corporation can acquire ownership of real estate properties or dispose of company vehicles.
Both the Person and Corporation classes realize the Owner interface, meaning they provide concrete implementations for the "acquire(property)" and "dispose(property)" methods defined in the interface.

#include <iostream>
using namespace std;
// Interface (Abstract Class)
class Owner {
public:
virtual void acquire(const string& property) = 0;
virtual void dispose(const string& property) = 0;
virtual ~Owner() = default;
};
// Person realizes Owner
class Person : public Owner {
public:
void acquire(const string& property) override {
cout << "Person acquired " << property << endl;
}
void dispose(const string& property) override {
cout << "Person disposed " << property << endl;
}
};
// Corporation realizes Owner
class Corporation : public Owner {
public:
void acquire(const string& property) override {
cout << "Corporation acquired " << property << endl;
}
void dispose(const string& property) override {
cout << "Corporation disposed " << property << endl;
}
};
int main() {
Person p;
Corporation c;
p.acquire("House");
c.acquire("Office");
}
// Interface
interface Owner {
void acquire(String property);
void dispose(String property);
}
// Person realizes Owner
class Person implements Owner {
public void acquire(String property) {
System.out.println("Person acquired " + property);
}
public void dispose(String property) {
System.out.println("Person disposed " + property);
}
}
// Corporation realizes Owner
class Corporation implements Owner {
public void acquire(String property) {
System.out.println("Corporation acquired " + property);
}
public void dispose(String property) {
System.out.println("Corporation disposed " + property);
}
}
public class Main {
public static void main(String[] args) {
Owner p = new Person();
Owner c = new Corporation();
p.acquire("House");
c.acquire("Office");
}
}
from abc import ABC, abstractmethod
# Interface
class Owner(ABC):
@abstractmethod
def acquire(self, property): pass
@abstractmethod
def dispose(self, property): pass
# Person realizes Owner
class Person(Owner):
def acquire(self, property):
print(f"Person acquired {property}")
def dispose(self, property):
print(f"Person disposed {property}")
# Corporation realizes Owner
class Corporation(Owner):
def acquire(self, property):
print(f"Corporation acquired {property}")
def dispose(self, property):
print(f"Corporation disposed {property}")
p = Person()
c = Corporation()
p.acquire("House")
c.acquire("Office")
// Interface (simulated via abstract class)
class Owner {
acquire(property) { throw new Error("Not implemented"); }
dispose(property) { throw new Error("Not implemented"); }
}
// Person realizes Owner
class Person extends Owner {
acquire(property) {
console.log(`Person acquired ${property}`);
}
dispose(property) {
console.log(`Person disposed ${property}`);
}
}
// Corporation realizes Owner
class Corporation extends Owner {
acquire(property) {
console.log(`Corporation acquired ${property}`);
}
dispose(property) {
console.log(`Corporation disposed ${property}`);
}
}
let p = new Person();
let c = new Corporation();
p.acquire("House");
c.acquire("Office");
Output
Person acquired House Corporation acquired Office