adplus-dvertising
frame-decoration

Question

Find which of the following uses encapsulation?

a.

void main(){ int a; void fun( int a=10; cout<<a); fun(); }

b.

class student{ int a; public: int b;};

c.

class student{int a; public: void disp(){ cout<<a;} };

d.

struct topper{ char name[10]; public : int marks; }

Answer: (c).class student{int a; public: void disp(){ cout<<a;} };

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Find which of the following uses encapsulation?

Similar Questions

Discover Related MCQs

Q. Encapsulation helps in writing ___________ classes in java

Q. Which among the following should be encapsulated?

Q. How can Encapsulation be achieved?

Q. Which among the following violates the principle of encapsulation almost always?

Q. Which among the following would destroy the encapsulation mechanism if it was allowed in programming?

Q. Which among the following can be a concept against encapsulation rules?

Q. Encapsulation is the way to add functions in a user defined structure.

Q. Using encapsulation data security is ___________

Q. Which among the following best defines abstraction?

Q. Hiding the implementation complexity can:

Q. Class is _________ abstraction

Q. Object is ________ abstraction

Q. Abstraction gives higher degree of ________

Q. Abstraction can apply to:

Q. Which among the following can be viewed as combination of abstraction of data and code.

Q. Abstraction principle includes___________

Q. Higher the level of abstraction, higher are the details.

Q. Encapsulation and abstraction differ as:

Q. In terms of stream and files________

Q. If two classes combine some private data members and provides public member functions to access and manipulate those data members. Where is abstraction used?