Difference between revisions of "Encapsulation - 2017"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
Line 1: Line 1:
 
Encapsulation is the process of combining functions and data into a single place, a class in C# (and others), that prevents the user from directly accessing the data stored. They are stored as private, public & protected.
 
Encapsulation is the process of combining functions and data into a single place, a class in C# (and others), that prevents the user from directly accessing the data stored. They are stored as private, public & protected.
 +
 +
<syntaxhighlight lang="csharp">
 +
class Encapsulation {
 +
public getData1();
 +
public getData2();
 +
 +
private int data1;
 +
private string data2;
 +
 +
}
 +
</syntaxhighlight>

Revision as of 14:02, 6 February 2017

Encapsulation is the process of combining functions and data into a single place, a class in C# (and others), that prevents the user from directly accessing the data stored. They are stored as private, public & protected.

class Encapsulation {
 public getData1();
 public getData2();

 private int data1;
 private string data2;

}