- 1
Can we access Private protected and public access specifiers at the same time in c++?
Hello every body. in c++ oop we create classes and in the class we use something called access specifiers my question is, is it possible to access all the access specifiers at the same time... while inherating the features of the base class(existing class) to the derived class(child class).... thank you all in advance
4 odpowiedzi
+ 2
How do you mean "access access specifiers"?
A friend function can access private and protected variables.
+ 2
In your sum class, you can't access private members of multiply but all the public things from multiply are private in sum.
To access private variables, use the friend keyword.
+ 2
The meaning of the friend declaration is the same whether the friend declaration appears in the private, protected or public portion of the class member-specification.
so yes using friend function u can access all members declared as private,protected and public.
0
bro we have 3 access specifiers in the class.
private .
public.
protected.
while a creating a new child class from base class we use a syntax.
i.e
parent class : access specifiers child class.
suppose i have a class sum.
and now i want to create a new class .
sum : private multiply
{
};
this is the syntax i want or my mean is can i use smthing instead private to access all the access specifiers..
hope u got me....