answersLogoWhite

0


Best Answer

Assume you were asking as in C#, not C. Because C is not an OO language, thus if there is encapsulation, it would be different.

The encapsulation in any OO language is to hide the information of data and the implementation detail of a method.

For example, you have a bank account as a private data member. Any one can ask you about the Balance of your bank account, e.g. GetDeposits(), an operation that is public. Wait, you now are richer, and you open 2 more bank accounts, the public still has the only accessing method GetDeposits(), to get your total deposits.

The encapsulation in this abstraction are:

1. The detail, the implementation of GetDeposits(), is not revealed to public.

2. The data member, 1 account or 3 accounts, no one got impact, and no one knows. (in fact, no one knows how many bank accounts you have!)

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

8y ago

Encapsulation is a feature of object oriented programming languages. As such there is no concept of encapsulation in C.

This answer is:
User Avatar

User Avatar

Wiki User

9y ago

The C Programming language does not provide any encapsulation. For that you need C++.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is encapsulation in c?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Can abstraction encapsulation be achieved in C program if yes explain?

abstraction and encapsulation is one of the concepts of OOPs and C is not an OOP [Object Oriented Programming language] obviously abst & encap will not be supported by 'C' Abstraction & encapsulation is a concept of OOP [Object Oriented Programming] But, 'C' is not an OOP whereas it is a POP [Procedure oriented programming], so obviously 'C' does not support abstraction and encapsulation Answer Encapsulation is not inherently supported but it can be emulated in C. The use of static and extern keywords for functions are almost equivalent to your private and public keywords in java (encapsulation). Read up more on those keywords.. Structures become an object's attributes while functions accepting pointers the the said struct become its methods.


Which is the most common encapsulation in use on BRI Interface?

Which is the most common encapsulation in use on BRI Interface ? A. SDLC B. ATN C. HDLC D. PPP


What is the term that describes the hiding of implementation details of objects from each other in a C plus plus class?

Encapsulation.


What is encapsulation in c sharp?

I think the question should be modified as "What is the encapsulation in Object-Oriented programming?" instead of in C#. C# itself is not encapsulated. It supports OO programming, and encapsulation is one of the main characteristics of OO programming". The encapsulation in plain English is to hide a piece of information (data) or behavior (the code) within the object itself. Outside of the object should not and cannot know about it. For instance, let's say you want to add 1 to a property of an object: Person me = new Person(); me.Wallet.Content += 1; The above shows the traditional way of adding 1 to the content of my wallet. But if you examine the code carefully, it was like: "give me all the contents in your wallet, I'll add 1 to those, then put the new contents back in". There is no encapsulation in that code segment. Person me = new Person(); me.AddToWalletContent(1); The above code segment shows a way of encapsulation. Noted that there is no property of Wallet, no property of Content of a Wallet directly being seen here. That's the encapsulation in a nut shell. How the object me (an instance of Person) implements AddToWalletContent(int aNumber) is not the concern of the consumer, and the consumer has no knowledge (does not know, and should not know) about the person has a wallet or not, and if he does, what the contents were before adding 1 to them. I hope the above examples shed some lights about encapsulation in OO.


3 pillars of object oriented programming?

abstraction, inheritance, encapsulation, and polymorphism.

Related questions

Can abstraction encapsulation be achieved in C program if yes explain?

abstraction and encapsulation is one of the concepts of OOPs and C is not an OOP [Object Oriented Programming language] obviously abst & encap will not be supported by 'C' Abstraction & encapsulation is a concept of OOP [Object Oriented Programming] But, 'C' is not an OOP whereas it is a POP [Procedure oriented programming], so obviously 'C' does not support abstraction and encapsulation Answer Encapsulation is not inherently supported but it can be emulated in C. The use of static and extern keywords for functions are almost equivalent to your private and public keywords in java (encapsulation). Read up more on those keywords.. Structures become an object's attributes while functions accepting pointers the the said struct become its methods.


Which is the most common encapsulation in use on BRI Interface?

Which is the most common encapsulation in use on BRI Interface ? A. SDLC B. ATN C. HDLC D. PPP


What is the name of the process of building a frame around network layer information?

Encapsulation. Actually, this is one type of encapsulation; encapsulation occurs at several layers.Encapsulation. Actually, this is one type of encapsulation; encapsulation occurs at several layers.Encapsulation. Actually, this is one type of encapsulation; encapsulation occurs at several layers.Encapsulation. Actually, this is one type of encapsulation; encapsulation occurs at several layers.


What has the author Kirk C Benson written?

Kirk C. Benson has written: 'Modeling data encapsulation and a communication network for the National Training Center, Fort Irwin, CA' -- subject(s): SCENARIOS, ENCAPSULATION, ARMY TRAINING, COMMUNICATIONS NETWORKS, MODEL THEORY


What is the term that describes the hiding of implementation details of objects from each other in a C plus plus class?

Encapsulation.


What are the concepts of object oriented programming in c plus plus?

The concepts of OOP in C++ are the same as for OOP in any other programming language: abstraction, encapsulation, inheritance and polymorphism.


Which command sets the encapsulation on a Serial interface back to the Cisco default?

encapsulation hdlc


What is encapsulation in c sharp?

I think the question should be modified as "What is the encapsulation in Object-Oriented programming?" instead of in C#. C# itself is not encapsulated. It supports OO programming, and encapsulation is one of the main characteristics of OO programming". The encapsulation in plain English is to hide a piece of information (data) or behavior (the code) within the object itself. Outside of the object should not and cannot know about it. For instance, let's say you want to add 1 to a property of an object: Person me = new Person(); me.Wallet.Content += 1; The above shows the traditional way of adding 1 to the content of my wallet. But if you examine the code carefully, it was like: "give me all the contents in your wallet, I'll add 1 to those, then put the new contents back in". There is no encapsulation in that code segment. Person me = new Person(); me.AddToWalletContent(1); The above code segment shows a way of encapsulation. Noted that there is no property of Wallet, no property of Content of a Wallet directly being seen here. That's the encapsulation in a nut shell. How the object me (an instance of Person) implements AddToWalletContent(int aNumber) is not the concern of the consumer, and the consumer has no knowledge (does not know, and should not know) about the person has a wallet or not, and if he does, what the contents were before adding 1 to them. I hope the above examples shed some lights about encapsulation in OO.


3 pillars of object oriented programming?

abstraction, inheritance, encapsulation, and polymorphism.


Why encapsulation is needed in java?

Encapsulation is not needed in Java, or any other language. But it's useful. Encapsulation is used to minimise the number of potential dependencies with the highest probability of change propagation.


Is encapsulation a characteristic of procedural or object oriented programming?

Encapsulation is one of the four pillars of object-oriented programming. The other three are inheritance, polymorphism and abstraction.


What are the main features of OOP in c plus plus?

The main features of OOP are the same regardless of the language. They are: encapsulation; data hiding; inheritance; and polymorphism.