Book a Demo

Author Topic: How to programmatically say that a class inherits from another one?  (Read 3957 times)

MPoudret

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Hello,

I am looking for a way to programmatically set the parent class of a given class (considering a class A and a class B, I want to say that B inherits from A, both classes already exist). Does the EA.Element BaseClasses attributes allows this? I tried things like:

Code: [Select]
(B.BaseClasses.AddNew(A.ElementGUID, "Class")).update();
B.BaseClasses.Refresh();
B.Update();

Thanks,
Mathieu (I am new here  :) )

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to programmatically say that a class inherits from another one?
« Reply #1 on: February 08, 2018, 04:29:55 am »
Add a Generalization to the subclass's connectors collection and set the target id to the superclass.

Geert

MPoudret

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: How to programmatically say that a class inherits from another one?
« Reply #2 on: February 08, 2018, 05:37:08 am »
Add a Generalization to the subclass's connectors collection and set the target id to the superclass.

Geert

Thanks!!!

Mathieu