So, I was thinking about OOP and inheritance, and I got to thinking about a new construct in OOP where you specify dominant and recessive properties/methods like with real inheritance.
Consider two objects Mother, Father in a fictional language:
Then, you could create a new object that doesn't have a particular type itself, but is instead a juxtaposition of both provided types upon construction.
I think this could be interesting if developed further.
Consider two objects Mother, Father in a fictional language:
class Mother { dominant void doWork() { } void beMotherly() { } } class Father { void doWork() { } void beFatherly() { } }
Then, you could create a new object that doesn't have a particular type itself, but is instead a juxtaposition of both provided types upon construction.
Child child = new (Father, Mother); child.doWork(); // calls mother's doWork(); child.beMotherly(); child.beFatherly();
I think this could be interesting if developed further.
0 Comments On This Entry
← March 2021 →
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
Tags
My Blog Links
Recent Entries
-
-
-
Programming Construct Idea
on Dec 14 2018 05:57 PM
-
-
Recent Comments
Search My Blog
1 user(s) viewing
1 Guests
0 member(s)
0 anonymous member(s)
0 member(s)
0 anonymous member(s)