Computer Science, asked by AAFT53, 1 year ago

Which of the following statements is correct?

A.Data items in a class must be private.
B.Both data and functions can be either private or public.
C.Member functions of a class must be private.
D.Constructor of a class cannot be private.

Answers

Answered by Anonymous
6
ʜᴇʟʟᴏ ᴅᴇᴀʀ....

✔✔✔✔✔✔✔✔✔✔✔

ʙ. ʙᴏᴛʜ ᴅᴀᴛᴀ ᴀɴᴅ ғᴜɴᴄᴛɪᴏɴs ᴄᴀɴ ʙᴇ ᴇɪᴛʜᴇʀ ᴘʀɪᴠᴀᴛᴇ ᴏʀ ᴘᴜʙʟɪᴄ.

ᴄᴏʀʀᴇᴄᴛ ᴀɴꜱᴡᴇʀ......
Answered by swethassynergy
0

B. Both data and functions can be either private or public.

The correct statement is Both data and functions can be either private or public.

Explanation:

  • In a class , the data can be considered in general with respect to any quantity and can be taken into considerations so that it can be accessed easily.
  • The member functions of a class should be public to  access the class.
  • Constructor can be a private where a class under class known as subclass is used.
  • Only data and functions can be either public or private as per the requirement for the processing of the algorithm.

Similar questions