subramanian100in wrote:
I am a beginner in C++. I come across the terms data abstraction and
encapsulation in C++.
I am unable to understand the definitions.
Kindly explain these terms with a simple example in C++
"Abstraction" means its dictionary definition, which is probably "replace a
complex topic with a simple name, as a convenient reference." That's all it
can mean; there is (thankfully!) no C++ keyword 'abstract'!
Learn the keyword 'virtual', to get with one of C++'s abstracting systems.
"Encapsulation" means each object in a program has a capsule, which is the
set of methods used to operate it. The most trivial example is:
class Foo
{
public:
int getBar();
private:
int Bar;
};
That means the calling code cannot access Bar directly. The class Foo can
therefor maintain Bar, and can ensure that client code always thinks it
contains the correct value. These rules make programs easier to change and
upgrade.
--
Phlip
http://www.oreilly.com/catalog/9780596510657/
"Test Driven Ajax (on Rails)"
assert_xpath, assert_javascript, & assert_ajax