No announcement yet.
  • Filter
  • Time
Clear All
new posts

  • NF
    Thanks, we used a slightly different approach for this problem, we used Mixing Pattern (with classes) to extend both myTreeGrid and myListGrid (with the commonListGrid Class).

    Leave a comment:

  • Isomorphic
    Java would make this hard but in JavaScript it's trivial: create a method that adds the common methods and properties to the target class, and call it twice, once for your ListGrid subclass and once for your TreeGrid subclass.

    Leave a comment:

  • NF
    started a topic Add same functionality to two classes

    Add same functionality to two classes

    We are looking to extend the functionality of listGrid and treeGrid with the same functions -
    The new functions are both for listGrid and treeGrid.
    We know that treeGrid is inherited from listGrid.
    As far as I know, we cant change listGrid class...
    Is there a way to add the common functionality without writing the code twice?
    There is a diagram which demonstrates our expected result -

    Last edited by Isomorphic; 22nd Jan 2020, 12:48.