Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Dynamic Inheritance  RSS feed

 
Niyas Ahmed Sheikh
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

What is Dynamic Inheritance. What are the Pros and cons of using it?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some less strongly typed languages let you change the parent class of an an object at runtime. I was just reading about this yesterday in ECMAScript aka JScript where you can change the template (parent class) on the fly.

THIS ARTICLE claims to do dynamic inheritance in Java but it's just using a Factory Method and not changing anything about a given object instance.

We can get more dynamic behavior through delegation and swapping strategies at runtime, but it's still not really changing the parent class.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!