struct is used as Base class for inheritance - Inheritance

Q.  Can struct be used as Base class for inheritance ?
- Published on 19 Jul 15

a. Yes
b. No

ANSWER: Yes
 

    Discussion

  • sumant kumar   -Posted on 30 Sep 16
    yes because stuct have by default public specifier which can act as base class for our program
  • Manjinder Singh   -Posted on 16 Sep 16
    In c++, struct is a special type of class, with default access specifier as Public for its members.
    Since we'll be deriving members from a class(struct) into our class, & since the data types are same, it's possible to derive from a struct type without loosing the information.
  • ramesh   -Posted on 08 Oct 15
    Yes struct can be used as base class for inheritance but default accessibility is public for struct.

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.)