Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

General Encapsulation vs Class Encapsulation

Name: Anonymous 2007-12-16 22:08

In general, what I am talking about is a general purpose alternative to private, that being hidden. This is a general purpose encapsulation that can be used anywhere, and it can't be accessed or redefined in sub-blocks. Consider what's below:

Global Scope
hidden int _hidden_static;
_hidden_static=0; //Fine
void some_func() {_hidden_static=0;} //Illegal


Local Scope
void some_func() {
    hidden int _hidden_local;

    _hidden_local=0;   //Fine
    {_hidden_local=0;} //Illegal
}


Class Scope
It is the same as private except that the members cannot be redefined in any scope, including the class methods. Any polymorphic method would of course have to be able to make an exception to the redefinition rule.

What do you think of this?

Name: Anonymous 2007-12-16 23:08

>>2
Consider:
hidden unsigned int y = +constant;
leaf for (hidden unsigned int x = 0; x < y; ++x) { ... }

Incremental loops like the above are guaranteed to terminate.

There are other benefits, but I'll leave you to think about them.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List