[Opengeoscience-developers] Protected access in javascript

Aashish Chaudhary aashish.chaudhary at kitware.com
Wed Sep 11 13:32:39 EDT 2013


Hi Ben,

I looked at it earlier. Although its kind of good its not perfect (none of
the others too). The problem is that

1. You should be checking if the call to constructor is coming from a
derived class indeed

2. The API gets clunky (the constructor I guess). Although its not bad.

Although I was thinking of something similar but instead in the constructor
we have this dedicated method that you need to call and there we check if
its coming from one of its own,
and attach its protected member variables. This method can be called right
after we instantiate the base class members.


- Aashish


On Wed, Sep 11, 2013 at 10:42 AM, Ben Burnett <benjam.arlyn at gmail.com>wrote:

> Has anyone looked at this solution?
>
> http://stackoverflow.com/a/8703764
>
> One flaw is that users who instantiate the base class directly could get
> access to these protected values if they knew what they were doing, but
> otherwise it seems good, and doesn't add any members that are directly
> visible on the objects.
>
> _______________________________________________
> Opengeoscience-developers mailing list
> Opengeoscience-developers at public.kitware.com
>
> http://public.kitware.com/cgi-bin/mailman/listinfo/opengeoscience-developers
>
>


-- 
| Aashish Chaudhary
| R&D Engineer
| Kitware Inc.
| www.kitware.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/opengeoscience-developers/attachments/20130911/b6e30cea/attachment.html>


More information about the Opengeoscience-developers mailing list