A. Invalid due to the fact that you need to make the class abstract due to the fact that there is an abstract role inside.
You are watching: Which of the following class definitions is correct in c++?
class Ghost abstract void haunt();B. This is not the correct answer, yet I don"t know why due to the fact that it is an summary class, and also they can not be instantiated. The other option is that it"s an invalid definition, yet I don"t see exactly how it can be invalid, that only has a duty call.
abstract course Ghost void haunt();C. This is the exactly answer
abstract class Ghost void haunt() ;D. It"s not a class but a method so that can"t be instantiated
abstract Ghost summary void haunt();E. Needs "abstract" instead of "static"
static class Ghost abstract haunt();
enhance this concern
request Feb 15 "16 at 22:13
8911 silver- badge88 bronze title
include a comment |
2 answers 2
active oldest Votes
B is invalid since the technique haunt has no implementation and also not declared abstract. It must be
abstract class Ghost summary void haunt();Only interfaces can declare abstract approaches without heralding them abstract clearly
interface Gost void haunt();
boost this answer
edited Feb 15 "16 at 22:26
reply Feb 15 "16 at 22:18
Sleiman JneidiSleiman Jneidi
21.5k1212 gold badges5151 silver badges6969 bronze badges
include a comment |
In option B
void haunt();is not a an approach call, it"s in reality a method an interpretation and it"s invalid due to the fact that it doesn"t have method body and also doesn"t marked as abstract.
improve this prize
answered Feb 15 "16 in ~ 22:17
2122 bronze title
add a comment |
Thanks because that contributing solution to ridge Overflow!Please be certain to answer the question. Provide details and share your research!
But avoid …Asking because that help, clarification, or responding to other answers.Making statements based upon opinion; back them increase with recommendations or an individual experience.
To find out more, view our advice on writing good answers.
See more: Diary Of A Wimpy Kid Cabin Fever Pdf Download, Diary Of A Wimpy Kid Cabin Fever
Sign up or log in
sign up utilizing Google
sign up utilizing Facebook
authorize up using Email and Password
Post as a guest
email Required, but never shown
Post together a guest
Required, but never shown
article Your prize Discard
Not the answer you're looking for? Browse other questions tagged java abstract-class or questioning your very own question.
The Overflow Blog
Featured top top Meta
how do ns test a class that has private methods, fields or inner classes?
Fastest way to recognize if one integer's square source is an essence
Why can't I specify a static an approach in a Java interface?
interface vs Abstract course (general OO)
interface or an summary Class: which one come use?
What is the difference between an interface and also abstract class?
Why room static variables thought about evil?
class 'Room' is abstract; cannot be instantiated
exactly how should ns have described the difference in between an Interface and also an abstract class?
hot Network inquiries much more hot concerns
subscribe to RSS
concern feed To i ordered it to this RSS feed, copy and also paste this URL into your RSS reader.
stack Exchange Network
site style / logo design © 2021 ridge Exchange Inc; user contributions license is granted under cc by-sa. Rev2021.10.27.40585