[HD Pg 217, Sec. 8.6.1 - encapsulation]
Moderator: admin
-
- Posts: 221
- Joined: Mon Nov 26, 2018 2:43 pm
- Contact:
[HD Pg 217, Sec. 8.6.1 - encapsulation]
"Encapsulation is considered as one of the three pillars of Object-Oriented Programming. The other two being Inheritance and Polymorphism."
Then where does Abstraction fall?
Then where does Abstraction fall?
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: [HD Pg 217, Sec. 8.6.1 - encapsulation]
Abstraction is a process of identifying the key characteristics of an entity. I would include it within inheritance and polymorphism. But there can be multiple views.
https://en.wikipedia.org/wiki/Object-or ... rogramming
https://en.wikipedia.org/wiki/Object-or ... rogramming
-
- Posts: 221
- Joined: Mon Nov 26, 2018 2:43 pm
- Contact:
Re: [HD Pg 217, Sec. 8.6.1 - encapsulation]
Do you know where do the exam producers come down on OOP having 3 pillars or 4?
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: [HD Pg 217, Sec. 8.6.1 - encapsulation]
You will not be quizzed on this in the exam. So, if you like to believe that abstraction is the 4th pillar, thats fine 

-
- Posts: 221
- Joined: Mon Nov 26, 2018 2:43 pm
- Contact:
Re: [HD Pg 217, Sec. 8.6.1 - encapsulation]
Pillar, caterpillar - I just want to pass the DMV's lab driving conditions and to real world driving 

-
- Posts: 221
- Joined: Mon Nov 26, 2018 2:43 pm
- Contact:
Re: [HD Pg 217, Sec. 8.6.1 - encapsulation]
Question,
A twisted encapsulation question, which someone told me they saw on some exam. I was going to ignore it, but I figured I might as well give you a chance to ignore it too:)
Here it is,
"Describe a scenario that the fields instead of being private are public final and yet encapsulation is achieved?"
A twisted encapsulation question, which someone told me they saw on some exam. I was going to ignore it, but I figured I might as well give you a chance to ignore it too:)
Here it is,
"Describe a scenario that the fields instead of being private are public final and yet encapsulation is achieved?"
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: [HD Pg 217, Sec. 8.6.1 - encapsulation]
Sorry, no idea what it is talking about.
-
- Posts: 221
- Joined: Mon Nov 26, 2018 2:43 pm
- Contact:
Re: [HD Pg 217, Sec. 8.6.1 - encapsulation]
It read too weird in relation to the concept of encapsulation, but figured to better make sure.
-
- Posts: 221
- Joined: Mon Nov 26, 2018 2:43 pm
- Contact:
Re: [HD Pg 217, Sec. 8.6.1 - encapsulation]
Right before the title, Encapsulation in Java:
class Person{
private age;
should be
class Person{
private int age;
also
shouldn't
else age = yrs;
be
else this.age = yrs;
class Person{
private age;
should be
class Person{
private int age;
also
shouldn't
else age = yrs;
be
else this.age = yrs;
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: [HD Pg 217, Sec. 8.6.1 - encapsulation]
1. Yes, added to errata.
2. Not necessarily. When there is no conflict in variable names, "this" is optional if you want to refer to an instance field. Using "this." explicitly is considered better though. Explained in section 3.4.2
2. Not necessarily. When there is no conflict in variable names, "this" is optional if you want to refer to an instance field. Using "this." explicitly is considered better though. Explained in section 3.4.2
Who is online
Users browsing this forum: No registered users and 10 guests