C# Programming - Classes and Objects - Discussion
Discussion Forum : Classes and Objects - General Questions (Q.No. 8)
8.
Which of the following statements are correct?
- Data members ofa class are by default public.
- Data members of a class are by default private.
- Member functions of a class are by default public.
- A private function of a class can access a public function within the same class.
- Member function of a class are by default private.
Discussion:
3 comments Page 1 of 1.
Sridhar said:
6 years ago
Why? 1St one is also correct public declared anywhere there is no restriction.
Fation said:
9 years ago
@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.
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.
(1)
Venkat said:
9 years ago
Not private, internal by default.
(1)
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers