Setting a constructor to private

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Post Reply
Deeler Stan
Posts: 410
Joined: Thu Mar 31, 2005 3:44 am

Setting a constructor to private

Post by Deeler Stan » Fri Sep 12, 2008 3:55 am

Hi guys

Just trying out this persistent objects stuff and I'm creating a class to control the use of the persistent object I've created but I want to make the constructor private.

Problem is, when I create the consturctor it is set to public and I cant seem to change it.

Any ideas.

I'm on 4.7 btw.

Cheers

Stan

Gothmog
Posts: 1952
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home

Re: Setting a constructor to private

Post by Gothmog » Fri Sep 12, 2008 4:32 am

Can't you set the Instantiation to Private in the class properties (first tab in the class builder) ?
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67

Deeler Stan
Posts: 410
Joined: Thu Mar 31, 2005 3:44 am

Re: Setting a constructor to private

Post by Deeler Stan » Fri Sep 12, 2008 5:07 am

I can, but it leaves the consturctor set as instance/public. I deleted it and re-created it but it is still the same.

The good news is that I decided to test creating an object outside the class and it won't let me, so in all, your idea works, SAP just likes to say it's still a public constructor.

Thanks for the solution

Cheers

Stan...

Post Reply