Hi i am educating myself oop principles. I would like to know if this is a correct example of Cardellis definition of parametric polymorphism. Please enlighten me.
The example is in cfml's script based syntax.
<cfscript>
Parent = createobject("component","webapp.model.Parent").init();
Child = createobject("component","webapp.model.Child").init();
GrandChild = createobject("component","webapp.model.GrandChild").init();
Test = createobject("component","webapp.model.DealWithObject");
dump(Test.getNumberOfParents(Parent));
dump(Test.getNumberOfParents(Child));
dump(Test.getNumberOfParents(GrandChild));
</cfscript>
<cfcomponent>
<cfscript>
// should deal with an infinte number of abstract data types (because of common structure)
public numeric function getNumberOfParents(component arg){
return -1 + arraylen(structfindkey(getmetadata(arguments.arg),"extends","all"));
}
</cfscript>
</cfcomponent>