What do you think about private and protected?

I think it should be a great thing to have two notions: class private and instance private (and the same for protected).

In my mind, in a lot of case, I shouldn’t be able to do this:

class C1


    private int _test = 0;

    public int Test(C1 c1)


        return c1._test;



Indeed, when I define _test as (instance) private, I don’t want any different instance than me could access my member.

It’s probably more important for protected because I don’t know my derived class code.


It’s sure that we must keep the class private (or protected) for singleton case for example.


What do you think about this?

This entry was posted in 7671, 7672, 7673, 7678. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *