Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the antonym of encapsulation?

Using online dictionary tools doesn't really help. I think the way encapsulate is use in computer science doesn't exactly match its meaning in plain English.

What is the antonym of computer science's version of encaspulate? More specifically, what is an antonym for encapsulate that would work as a function name.


Why should I care? Here's my motivation:

// A class with a private member variable;
class Private
{
public:
   // Test will be able to access Private's private members;
   class Test;
private:
   int i;
}

// Make Test exactly like Private
class Private::Test : public Private
{
public:
   // Make Private's copy of i available publicly in Test
   using Private::i;
};

// A convenience function to quickly break encapsulation on a class to be tested.
// I don't have good name for what it does
Private::Test& foo( Private& p )
{ return *reinterpret_cast<Private::Test*>(&p); } // power cast

void unit_test()
{
   Private p;
   // using the function quickly grab access to p's internals.
   // obviously it would be evil to use this anywhere except in unit tests.
   assert( foo(p).i == 42 );
}
like image 605
deft_code Avatar asked Nov 11 '10 18:11

deft_code


People also ask

What is the opposite of encapsulation?

Opposite of to enclose (something) in or as if in a capsule. free. release. uncover. unwrap.

What is the synonym of encapsulation?

amplify, elaborate (on or upon), enlarge (on or upon), expand, supplement.

What is the antonym for?

Definition of antonym : a word of opposite meaning The usual antonym of good is bad.

What is the synonym and antonym of Cardinal?

Some common synonyms of cardinal are essential, fundamental, and vital. While all these words mean "so important as to be indispensable," cardinal suggests something on which an outcome turns or depends.


1 Answers

The antonym is "C".

Ok, just kidding. (Sort of.)

The best terms I can come up with are "expose" and "violate".

like image 72
cdhowie Avatar answered Nov 03 '22 20:11

cdhowie