answersLogoWhite

0


Best Answer

If this is a homework assignment, please consider trying to answer it yourself first, otherwise the value of the reinforcement of the lesson offered by the assignment will be lost on you.

To hide the data in a class in C++, simply declare the data private, and then manipulate the data using the public interface of the class.

User Avatar

Wiki User

βˆ™ 15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How can you hide the data in a class in C plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is message passing in c plus plus?

-define class with necessary data member & member function. -create object of that class. -communication.


When class will be used and when structure will be used?

In class default members are private and in structure default members are public ,When ever you want to hide data from outside functions then you can use class.But in ANSI C we can hide data by using private access specifier.


What is the order of initialization of data in C plus plus?

The general order of initialization is:Base class objects (if present)Member data objectsConstructor function code


Do the memory will be created for both private and public data members if the object is created for a class in c plus plus?

Yes.


Defference between c plus plus and c?

these are difference in between c and c++: a) C is a SPL and C++ is a OOP. b) C has not concept of object but C++ has this feature. c) C has not 'class' name data type but C++ has.


What is the difference between class data type and basic type in c plus plus .How can someone know which one is class type and which one is basic type.?

Basic types (primitive data types) have no methods associated with them.


What is object oriented in c plus plus?

Object-oriented programming is a feature in C++ that allows you to better model real-world objects. An object is an instance of a class, which is a data structure in C++ that allows you to group different, but related types of data together.


Can a c plus plus class be derived from a Java class?

No.


Structure in c plus plus?

Structures are the same as classes in C++. The only difference is that structure members are public by default while class members are private by default, but both define a class of object and both are initialised via a class constructor initialisation list. struct my_object { my_object(const int data): m_data(data) {} private: int m_data; }; The above struct is no different to the following class: class my_object { int m_data; public: my_object(const int data): m_data(data) {} };


What is the role of object in c plus plus?

An object in C++ is an instance of a C++ class.


How do you hide details of a class in C programming?

There are no classes in C and therefore no way to encapsulate information. Although it is possible to use structures containing both data and pointers to the functions that operate upon that data, and thus emulate object-oriented behaviour, all data is publicly accessible. To be hidden, data and implementation details need to be made private and there is no such mechanism in C.


What is nested class in c plus plus?

s.