Valid class definition - C++ basic concepts

Q.  class TEST
{
private:
int roll_no;
public:
int age;
char name[20];
private:
int grade;
protected:
char gender[20];
private:

private:
int m1, m2, m3;
};

In general view, is this class definition valid?

- Published on 17 Jul 15

a. Yes
b. No

ANSWER: Yes
 

    Discussion

  • Raj   -Posted on 23 Oct 15
    Yes, The given code snippet is perfectly valid. You can write access modifier keyword in more than one place.

Post your comment / Share knowledge


Enter the code shown above:
 
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)