Book a Demo

Author Topic: Creating a property from a Superclass  (Read 2978 times)

cochoa

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Creating a property from a Superclass
« on: August 27, 2003, 06:26:05 am »
I have a class A which is a superclass of B.
A has a protected attribute "_data". I would like to create a property "data" in B based on this attribute from its superclass (which is visible from B). However, the list of attributes of B does not contain "_data". Can anyone help?

Thx

Sean Kearon

  • EA User
  • **
  • Posts: 126
  • Karma: +0/-0
    • View Profile
Re: Creating a property from a Superclass
« Reply #1 on: August 27, 2003, 07:17:47 am »
Hi Cochoa

As A is a superclass of B, B inherits all attributes & methods of A.  You do not need to do anything more.  However, you will not see the attribute appear in class B, is implied due to the inheritance.

Regards

Sean

cochoa

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Creating a property from a Superclass
« Reply #2 on: August 27, 2003, 10:12:43 am »
Right, but when generating code I would like the code for B containing something like

public new XData data
{
get
                 {
                       return (XData)base.data;
                 }
           }

Sean Kearon

  • EA User
  • **
  • Posts: 126
  • Karma: +0/-0
    • View Profile
Re: Creating a property from a Superclass
« Reply #3 on: August 28, 2003, 02:18:05 am »
I could never get the code generation working as I wanted it, so don't use it.  However, EA 3.60 (Beta) has a new code templates feature which may get what you want.

cochoa

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Creating a property from a Superclass
« Reply #4 on: August 28, 2003, 04:42:44 am »
Thx!!