Mots clés : language-agnosticoopinheritancecompositionaggregationlanguage-agnostic
95
class Person { String Title; String Name; Int Age } class Employee : Person { Int Salary; String Title; }
class Person { String Title; String Name; Int Age; public Person(String title, String name, String age) { this.Title = title; this.Name = name; this.Age = age; } } class Employee { Int Salary; private Person person; public Employee(Person p, Int salary) { this.person = p; this.Salary = salary; } } Person johnny = new Person ("Mr.", "John", 25); Employee john = new Employee (johnny, 50000);
class Manager : Person, Employee { ... }
Class Manager { public string Title; public Manager(Person p, Employee e) { this.Title = e.Title; } }