Answer:
Yes, a class can be marked as protected but we have to use the concept of nested classes for that .
For a class can be marked as private we have to use the concept of nested classes for that or declare a class in a structure
example: These are valid examples:
class A
{
protected class B
{
}
}
class C
{
private class D
{
}
}
//Class can also be private inside a structure
struct empz
{
private class Class3
{
}
}
It is OK.
If a class is declared below a namespace it cannot be marked as protected or private.
Asked In: Many Interviews |
Alert Moderator