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

Can you think of a condition where your program would crash , Can you think...

Can you think of a condition where your program would crash without attaining the breakball, which you set at the straining of main()? A: C++ let for dynamic initialization of g

Operators, write a program to accept ten numbers and display the total

write a program to accept ten numbers and display the total

What should one throw?, A: C++, unlike only about every other language with...

A: C++, unlike only about every other language with exceptions, is extremely accomodating while it comes to what you can throw. Actually, you can throw anything you akin to. That b

Program to create a digital clock, Create a C language code, only one progr...

Create a C language code, only one program, to implement the following task. Task: Write C code for a program that implements a digital clock (HH:MM:SS). The clock inclu

D, drawbacks in assignments in engeenirng

drawbacks in assignments in engeenirng

Array, Write a program to count the prime number in array

Write a program to count the prime number in array

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