+ 1
What is encapsulation in python how to achieve it.
pls give me some examples
3 Respostas
- 1
abstraction mins hide your data...
use for secure important data
class Sample{
private int i =10;
}
now i is accessible only within class
encapsulation mins enclosing data in class
use function defunition in class
otherwise declare it and then give defination in outside of class
class Sample
{
public static void main(String args[]) {
void show()
{
}
void sayHi()
{
}
}
}
/* example codes are in java */
+ 1
thank you for your information.
could you tell diff detween encapsulation and abstraction with examples pls.
- 1
encapsulation mins wrapping of data in single class unit...
python use class concept