abstract method

I have a class that inherits from an abstract class.  Inside of this class is an abstract method.  In the inherited class I want the abstract method to be private.  When I code override I get an error that says "COBCH0965: Overriding method must have visibility Public" and from my understanding of Visual Cobol is legitimate.  The question comes into play when I use the cobol keyword override it seems to build just fine.  Is this the intent?  Below is an example of the redefines code.      

class-id Ufg.Life.Policy.PolicyAbstract abstract.

method-id GetPlanCode abstract

procedure division returning returningPlanCode as String.

end method.

*************** now for the class that inherits from the above class

class-id Ufg.Life.Policy.InforcePolicy inherits type Ufg.Life.Policy.PolicyAbstract.

method-id GetPlanCode redefine private

procedure division returning returningPlanCode as String.

end method.

Tags:

Parents
  • Verified Answer

    Can you please clarify your question as you mention an error using override yet the example you show is using redfine and not override.

    The redefine should work OK as this simply hides the method implementation in the parent class and redefines it using the new definition.

    Using override is different and the rules state that if you use override then the method must be defined as public and hence the error that you are seeing.

    Thanks.

Reply
  • Verified Answer

    Can you please clarify your question as you mention an error using override yet the example you show is using redfine and not override.

    The redefine should work OK as this simply hides the method implementation in the parent class and redefines it using the new definition.

    Using override is different and the rules state that if you use override then the method must be defined as public and hence the error that you are seeing.

    Thanks.

Children
No Data