Explain public and private members, C/C++ Programming

Assignment Help:

Public, Private and Protected members:

Class members can either be declared in public','protected' or in the 'private' sections of the class. But as one of the features of OOP is to stop data from unrestricted access, the data members of the class are normally declared in the private section. The member functions that form the interface among the object and the program are declared in public section (or else these functions can not be called from the program ). The member functions which may have been broken down further or those, which do not form a part of the interface, are declared in the private section of the class. By default all the members of the class are private.

The third access specifier 'protected' that is not used in the above example, pertains to the member functions of some new class that will be inherited from the base class. As far as non-member functions are concerned, private and protected are one  and the similar.

 


Related Discussions:- Explain public and private members

C program, Just need the answers to the following 3 questions. "NO NEED to ...

Just need the answers to the following 3 questions. "NO NEED to write a program compile or run it, do not need it. Just need the answers for the following questions. Example quest

Char, how many bytes required to char

how many bytes required to char

Influence on Social media - for Geek''s, Recently social media has been flo...

Recently social media has been flooded by fb posts, tweets, news articles about only thing demonetization.A great debate is ongoing over it. Most of the people discussing in social

What is the difference between structure and class, What is the difference ...

What is the difference between structure and class? - Members of structures are public while those of a class are private. - Classes provide data hiding while structures don

Decodethecode, decode smugglers are very smart in day by day

decode smugglers are very smart in day by day

C++ project, project on business management

project on business management

Subrotine assembly language, You have to write a subroutine (assembly langu...

You have to write a subroutine (assembly language code using NASM) for the following equation.

Program to store family members details, Program to store family members de...

Program to store family members details in C++: #include #include #include struct record {   char name[30];   int age;   char state[40]; }x; //cal

Define the system oriented data files, Define the System Oriented Data File...

Define the System Oriented Data Files? System-oriented data files are further closely related to the computer's operating system than Stream- oriented data files and they are s

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd