Click here to Skip to main content
15,904,351 members
Please Sign up or sign in to vote.
1.00/5 (5 votes)
See more:
is there any difference between the class and encapsulation

thanq
Posted

In Object Oriented Programming (OOP) class serve purpose of Encapsulation.

Forget about all. Please start your OOP journey from here[^]

Happy Programming
 
Share this answer
 
The difference is exactly the same as between "Titanic" and "navigation", see
http://en.wikipedia.org/wiki/Titanic[^],
http://en.wikipedia.org/wiki/Navigation[^].

If you still did not get it, try to answer this question: what's the difference between apple and Apple?

The questions like "What's the difference between {0} and {1}" are incorrect. Did you get it finally?

Please see: How to ask a good question?[^]. Please see other advice on this page, you really need it.

[EDIT] Please also see my comment to the post by Hugo.

—SA
 
Share this answer
 
v3
Comments
[no name] 9-Dec-11 14:26pm    
My 5!
Sergey Alexandrovich Kryukov 9-Dec-11 14:33pm    
Thank you, Pranit.
Good to deal with someone who understand things.

I expect down-votes on this answer. It often happen is similar cases, but I consider the answers like that as most important, won't give up.

--SA
Sergey Alexandrovich Kryukov 24-Jan-12 2:05am    
Ha-ha. I told that I expect down-votes on this answer. And the down-votes from some idiots.
I'm sure I'm not offending anyone. The anonymous voter is not a person, right?

Best wishes to everyone.
--SA
These two are of way different.

Class, could be defined as an instance of an Object.

Encapsulation, could be easily defined as "data hiding".

See, it is way far different from each other :)
Google?

Cheers!
 
Share this answer
 
encapsulation is not in programming. You are thinking of something else. Class is in programming, and some other things but not this one you ask for.

Maybe I am right?

Please be nice. This is my first test here
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 9-Dec-11 14:27pm    
Sorry, my vote of 1 because this looks like a plain lie. I really sorry but this is exactly what you have earned.

Even if there is any rational grain in this answer, you failed to explain it. Did you mean that encapsulation is conceptual, while class is something explicitly written using a key word, etc.? It would be better, but this is not so fundamental, and is not true for every language.

I can tell you the correct answer: the question is invalid, that is. Not all questions has a valid meaning. This one does not. What's the difference between apple and Apple? I would advise to avoid answering such questions. No matter how much you try, the answer can be considered invalid. Some say, "this is a fruit and another is a computer", some say: "one is capitalized always, another is not". Who is right? Nobody. The only right answer is: "the question is invalid". Got the picture?

--SA
Sergey Alexandrovich Kryukov 9-Dec-11 14:30pm    
By the way, I wish you success in helping people. Hope the next attempt will be better. Just take into account: don't post if you are not 100% sure, remember that making no harm is more important than help.

Cheers.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900