{"id":173,"date":"2013-08-01T15:53:38","date_gmt":"2013-08-01T13:53:38","guid":{"rendered":"http:\/\/www.4amics.com\/x.perez\/?p=173"},"modified":"2013-08-01T15:53:38","modified_gmt":"2013-08-01T13:53:38","slug":"multiple-inheritance-xtends","status":"publish","type":"post","link":"https:\/\/www.4amics.com\/x.perez\/2013\/08\/multiple-inheritance-xtends\/","title":{"rendered":"Multiple Inheritance &#8211; XTends"},"content":{"rendered":"<p>PHP can&#8217;t do multiple inheritance as :<\/p>\n<blockquote><p>class MyClass extends Base_controller, Another_controller<\/p><\/blockquote>\n<p>Interfaces doesn&#8217;t solve the problem, namespaces solve partialy, and traits it&#8217;s only an approach.<\/p>\n<p>Most of my developments have common classes, but every project have it&#8217;s own particularities.<br \/>\nI make developments under MVC concept, and all controllers have an inheritance from a Core_Controller, all models an inheritance from Core_Model, and so on&#8230;<\/p>\n<p>What to do if I have a model like &#8216;Products_Model.php&#8217; and it&#8217;s 90% of code that I can re-use for another projects ? Must I copy this to my created project ? Will I have new changes made in the original Products_Model ?<\/p>\n<p>Could I inherit from it&#8217;s methods and change\/develop my own method for my new project ? I CAN&#8217;T DO !!!<\/p>\n<p>But&#8230; there is a solution&#8230; XTends.<\/p>\n<p>With XTends I can have a &#8216;Product_model&#8217; inheriting from another &#8216;Product_model&#8217;, and also from my Core_Model<\/p>\n<p><a href=\"http:\/\/www.4amics.com\/x.perez\/wp-content\/uploads\/2013\/08\/Xtends_graphic.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-175\" title=\"Xtends_graphic\" src=\"http:\/\/www.4amics.com\/x.perez\/wp-content\/uploads\/2013\/08\/Xtends_graphic.jpg\" alt=\"\" width=\"518\" height=\"333\" srcset=\"https:\/\/www.4amics.com\/x.perez\/wp-content\/uploads\/2013\/08\/Xtends_graphic.jpg 518w, https:\/\/www.4amics.com\/x.perez\/wp-content\/uploads\/2013\/08\/Xtends_graphic-300x192.jpg 300w\" sizes=\"auto, (max-width: 518px) 100vw, 518px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Visit: \u00a0<a title=\"PHPClasses - XTends\" href=\"http:\/\/www.phpclasses.org\/package\/8154-PHP-Emulates-multiple-inheritance-of-classes.html\" target=\"_blank\">PHPClasses &#8211; XTends<br \/>\n<\/a><\/p>\n<p><a href=\"http:\/\/www.phpclasses.org\/package\/8154-PHP-Emulates-multiple-inheritance-of-classes.html\">B<\/a>itbucket: \u00a0<a title=\"XTends repository\" href=\"https:\/\/bitbucket.org\/xperez\/xtends-php5\" target=\"_blank\">Xtends Repository<\/a><\/p>\n<p>Demo: \u00a0<a title=\"Demo online\" href=\"http:\/\/www.4amics.com\/libraries\/xtends\/\" target=\"_blank\">Demo online<\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP can&#8217;t do multiple inheritance as : class MyClass extends Base_controller, Another_controller Interfaces doesn&#8217;t solve the problem, namespaces solve partialy, and traits it&#8217;s only an approach. Most of my developments have common classes, but every project have it&#8217;s own particularities. I make developments under MVC concept, and all controllers have an inheritance from a Core_Controller, [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-173","post","type-post","status-publish","format-standard","hentry","category-other"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.4amics.com\/x.perez\/wp-json\/wp\/v2\/posts\/173","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.4amics.com\/x.perez\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.4amics.com\/x.perez\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.4amics.com\/x.perez\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.4amics.com\/x.perez\/wp-json\/wp\/v2\/comments?post=173"}],"version-history":[{"count":7,"href":"https:\/\/www.4amics.com\/x.perez\/wp-json\/wp\/v2\/posts\/173\/revisions"}],"predecessor-version":[{"id":181,"href":"https:\/\/www.4amics.com\/x.perez\/wp-json\/wp\/v2\/posts\/173\/revisions\/181"}],"wp:attachment":[{"href":"https:\/\/www.4amics.com\/x.perez\/wp-json\/wp\/v2\/media?parent=173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.4amics.com\/x.perez\/wp-json\/wp\/v2\/categories?post=173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.4amics.com\/x.perez\/wp-json\/wp\/v2\/tags?post=173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}