C# Programming - Classes and Objects - Discussion

Discussion :: Classes and Objects - General Questions (Q.No.8)

8. 

Which of the following statements are correct?

  1. Data members ofa class are by default public.
  2. Data members of a class are by default private.
  3. Member functions of a class are by default public.
  4. A private function of a class can access a public function within the same class.
  5. Member function of a class are by default private.

[A]. 1, 3, 5
[B]. 1, 4
[C]. 2, 4, 5
[D]. 1, 2, 3
[E]. None of these

Answer: Option C

Explanation:

No answer description available for this question.

Venkat said: (Jan 21, 2016)  
Not private, internal by default.

Fation said: (Feb 24, 2016)  
@Venkat.

Only class access modifier it is internal by default. Data members and methods of class (object) it is private and the answer it is correct. Maybe you confused when this class it be base class.

Even when other class inherit from this base class the default access modifier are private. We should change to internal or public or protected access modifier of base class to be inherited from derived class.

Sridhar said: (Jun 28, 2018)  
Why? 1St one is also correct public declared anywhere there is no restriction.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.