Encapsulation is the ability to hide the internal workings of an object's behavior and its data.
For instance, let's say we have a object named Car and this object has a method named run(). When you create an instance of a Car object and call its run() method you are not worried about what happens to accomplish this, you just want to make sure the state of the Car is changed to 'running' afterwards.
This kind of behavior hiding is encapsulation and it makes programming much easier.
Search Your Question
Showing posts with label : C#. Show all posts
Showing posts with label : C#. Show all posts
Monday, May 5, 2008
What is encapsulation ? Give an example?
Thursday, April 24, 2008
When should a struct be used instead of a class?
They should be used for types that contain just a few data members..
Tuesday, April 22, 2008
C# basics - true false questions
- If a class is declared as abstract it is not possible to instantiate it - True
- If any method in a class is abstract, then that implies the class itself should be abstract - True
- Interface members are always public and cannot be declared as virtual or static - True
- Like COM interfaces C# interfaces also have to use GUIDs as identifiers - False
- Using the enum names in code makes code more readable - True
- Structures in C# are value types - True
- You can derive an interface from itself - False
Labels:
: C#
Subscribe to:
Posts (Atom)