0

Hey this is a conceptual question and create some curiosity in my mind that is it possible to create Class(not object) dynamically or in memory? and also we can define attributes and methods for this class dynamically as well.

Is this possible in any oops language ?

kundan bora
  • 3,821
  • 2
  • 20
  • 29

3 Answers3

1

Yes, it is possible in .NET. Look at System.Reflection.Emit namespace. Using types from it you can dynamically build assemblies and types in them.

Dennis
  • 37,026
  • 10
  • 82
  • 150
1

Yes you can do it using java Reflection API .

Pramod Kumar
  • 7,914
  • 5
  • 28
  • 37
1

Yes, it's doable in Java; the technique is generally referred to as bytecode generation. Libraries like cglib make it more doable, albeit it's going to be pretty complicated however you do it.

Louis Wasserman
  • 191,574
  • 25
  • 345
  • 413