<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr">
	<id>http://wiki.sage.fr/index.php?action=history&amp;feed=atom&amp;title=R%C3%B4les_d%27association</id>
	<title>Rôles d&#039;association - Historique des versions</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.sage.fr/index.php?action=history&amp;feed=atom&amp;title=R%C3%B4les_d%27association"/>
	<link rel="alternate" type="text/html" href="http://wiki.sage.fr/index.php?title=R%C3%B4les_d%27association&amp;action=history"/>
	<updated>2026-05-25T11:17:56Z</updated>
	<subtitle>Historique des versions pour cette page sur le wiki</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>http://wiki.sage.fr/index.php?title=R%C3%B4les_d%27association&amp;diff=2204&amp;oldid=prev</id>
		<title>Syfre : Nouvelle page : ===Introduction=== Un rôle d&#039;association est une association bidirectionnelle entre deux clases de multiplicité 0..* dans un sens et 0..* dans l&#039;autre.  {{#images:role-association....</title>
		<link rel="alternate" type="text/html" href="http://wiki.sage.fr/index.php?title=R%C3%B4les_d%27association&amp;diff=2204&amp;oldid=prev"/>
		<updated>2009-08-24T16:09:00Z</updated>

		<summary type="html">&lt;p&gt;Nouvelle page : ===Introduction=== Un rôle d&amp;#039;association est une association bidirectionnelle entre deux clases de multiplicité 0..* dans un sens et 0..* dans l&amp;#039;autre.  {{#images:role-association....&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nouvelle page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;===Introduction===&lt;br /&gt;
Un rôle d&amp;#039;association est une association bidirectionnelle entre deux clases de multiplicité 0..* dans un sens et 0..* dans l&amp;#039;autre.&lt;br /&gt;
&lt;br /&gt;
{{#images:role-association.png|dsm/roles}}&lt;br /&gt;
&lt;br /&gt;
Un rôle d&amp;#039;association utilise une classe d&amp;#039;association pour maintenir les couples d&amp;#039;objets associés.&lt;br /&gt;
&lt;br /&gt;
===Utilisation===&lt;br /&gt;
*Accès&lt;br /&gt;
&lt;br /&gt;
Les rôles d&amp;#039;associations ont une propriété [[Refs (role)|Refs[index]]] permettant d&amp;#039;accéder aux objets associés :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;#039;delphi&amp;#039;&amp;gt;&lt;br /&gt;
var idx:Integer;&lt;br /&gt;
begin&lt;br /&gt;
  for idx:=0 to instA.ClassBList.Count-1 do&lt;br /&gt;
   begin&lt;br /&gt;
     instB := instA.ClassBList.Refs[idx];&lt;br /&gt;
     ...&lt;br /&gt;
   end;&lt;br /&gt;
end;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ils disposent aussi d&amp;#039;une propriété par défaut en lecture seule :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;#039;delphi&amp;#039;&amp;gt;&lt;br /&gt;
var idx:Integer;&lt;br /&gt;
begin&lt;br /&gt;
  for idx:=0 to instA.ClassBList.Count-1 do&lt;br /&gt;
   begin&lt;br /&gt;
     instB := instA.ClassBList[idx];&lt;br /&gt;
     ...&lt;br /&gt;
   end;&lt;br /&gt;
end;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
L&amp;#039;accès aux objets de la classe d&amp;#039;association se fait à travers une fonction [[AssInstance (role)|AssInstance]] dont le paramètre est &amp;#039;&amp;#039;&amp;#039;l&amp;#039;identifiant de l&amp;#039;objet associé&amp;#039;&amp;#039;&amp;#039; :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;#039;delphi&amp;#039;&amp;gt;&lt;br /&gt;
var idx:Integer;&lt;br /&gt;
begin&lt;br /&gt;
  for idx:=0 to instA.ClassBList.Count-1 do&lt;br /&gt;
   begin&lt;br /&gt;
     instAB := instA.ClassBList.AssInstance(instB.ClassBList[idx].InstanceOID);&lt;br /&gt;
     ...&lt;br /&gt;
   end;&lt;br /&gt;
end;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Ajout d&amp;#039;objets dans l&amp;#039;associaton&lt;br /&gt;
Différentes manièrs d&amp;#039;ajouter un objet à un rôle liste :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;#039;delphi&amp;#039;&amp;gt;&lt;br /&gt;
begin&lt;br /&gt;
  instA.ClassBList.AdDRef(instA);&lt;br /&gt;
  instA.ClassBList.AddOID(instA.InstanceOID);&lt;br /&gt;
  ...&lt;br /&gt;
end;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Footer|Rôles (tech)}}&lt;br /&gt;
[[category:Rôles]]&lt;/div&gt;</summary>
		<author><name>Syfre</name></author>
	</entry>
</feed>