1. A class is an expanded concept of a data structure but it can hold two things
ID: 663227 • Letter: 1
Question
1. A class is an expanded concept of a data structure but it can hold two things which are what?
2. The body of a class declaration serves as the 'prototype' of the class. As such it can contain
members, and optional ??????? ??????? for access to those members.
3. An access specifier is one of three keywords:
4. private members of a class are accessible only from _____________ of the same class or from
their friends
5. public members are accessible from ________________ where the object is visible
Explanation / Answer
1.Classes are an expanded conept of data structure:like data structures,they can contain data members,but they can also contain functions as members.And a class broken into two things.The 1st is class header which consist of 'class' as a keyword.The 2nd is body .it consists of pair of brackets withstuff inbetween them.Code of a class;
class <identifier>
2.The body of the declaration can contain members, which can either be data or function declarations, and optionally access specifiers.For access those members we have to use access specifiers.
3.An access specifier is following one of three keywords; those are-Private and Public or Protected.These specifiers modifies the acess rights for the members.those are follows like next 2 questions.
4.Private members of a class are accessible only from within other members of the same class or from their friends.
5.Public members are accessible from anywhere.Where the object is visible.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.