• Post Reply Bookmark Topic Watch Topic
  • New Topic

An exercise question.  RSS feed

 
Lovish Setia
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Create two classes, A and B, with default constructors (empty argument lists) that announce themselves. Inherit a new class called C from A, and create a member of class B inside C. Do not create a constructor for C. Create an object of class C and observe"



In the above question what does this mean "create a member of class B inside C".

Is it that we have to just create object of class b in c or something else?
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16059
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It means that in class C, you have to add a member variable, and the type of that member variable should be B.
 
Saif Asif
Ranch Hand
Posts: 440
Eclipse IDE Hibernate Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes , it means you have to add a member variable of type B in class C.
 
Lovish Setia
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok thanks to all fo their replies.
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It also makes me suspect your instructor does not know what a default constructor is.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!