473,386 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

how can we use protected keyword?

how can we use protected keyword?
Aug 10 '10 #1
1 1645
weaknessforcats
9,208 Expert Mod 8TB
The protected keyword is used when the base class contains members that need to be accessible in a derived class without having to use a base class member function.

This is usually done when the base class is incomplete and it to be completed by a derived class. Here the intent is to create and use derived objects as deriuved objects but have the base class contain the data or ogic that is common to all derived classes without having to expose this information to classes outside the hierarchy.
Aug 10 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: Zeng | last post by:
Would somebody know when we should seal a class? Shouldn't all classes be open up for inheritance? Thanks!
12
by: Chris | last post by:
Hi I am trying to create a base class with the Protected keyword Protected MustInherit Class MyBaseClas .. .. End Clas And I got an error saying something like the Protected keyword...
12
by: Viru Rathore | last post by:
If struct keyword is support the all functionallity of class keyword, only differance i have found is accessibility of member is different in struct is public and class has private. This...
1
by: herc | last post by:
Here is what MSDN says about the constructor that is needed when implementing the ISerializable interface: "The ISerializable interface implies a constructor with the signature constructor...
7
by: Ant | last post by:
HI, I'm using the protected keyword in a class to make a method accessible to a child that inherits from it so as to be able to call the protected method from the child class. I can't seem to be...
4
by: Tina | last post by:
This is an issue regarding what exactly is accomplished by using "Protected" when defining a variable. It seems it does much more than just applying Protected status to a variable. I have an...
7
by: atomik.fungus | last post by:
Hi, im having problems compiling some code, and i dont understand why. I've made a Matrix class for any kind of data and now im implementing an inherited class with all the mathematical stuff...
6
by: Rick | last post by:
Hi, Can anyone explain to me why the below fails to compile - seeing otherA->f(); as a call to a inaccessible function, while otherB->f(); is ok? It seems you can happily access protected...
5
by: =?Utf-8?B?a21ybmVlZHNuZXRoZWxw?= | last post by:
I have the class structure shown below. When I compile I receive the following erros: 'B.B()' is inaccessible due to its protection level 'C.C()' is inaccessible due to its protection level I...
2
by: JB | last post by:
Hi All, I've just experienced a "strange" behaviour with inheritance and the Protected keyword. Can someone please shed a light on this? Is this the normal behaviour? Class Base Protected...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.