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();
java abstract-class
re-publishing
enhance this concern
follow
request Feb 15 "16 at 22:13

*

drossy11drossy11
8911 silver- badge88 bronze title
3
include a comment |

2 answers 2


active oldest Votes
3
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();
re-publishing
boost this answer
monitor
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
4
include a comment |
0
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.


share
improve this prize
follow
answered Feb 15 "16 in ~ 22:17
*

TheHckbluesTheHckblues
2122 bronze title
0
add a comment |

her Answer


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


Draft saved
Draft discarded

Sign up or log in


sign up utilizing Google
sign up utilizing Facebook
authorize up using Email and Password
send

Post as a guest


name
email Required, but never shown


Post together a guest


name
email

Required, but never shown


article Your prize Discard

By clicking “Post her Answer”, girlfriend agree to our regards to service, privacy policy and also cookie plan


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
associated
2973
how do ns test a class that has private methods, fields or inner classes?
1545
Fastest way to recognize if one integer's square source is an essence
538
Why can't I specify a static an approach in a Java interface?
1488
interface vs Abstract course (general OO)
348
interface or an summary Class: which one come use?
1876
What is the difference between an interface and also abstract class?
676
Why room static variables thought about evil?
16
class 'Room' is abstract; cannot be instantiated
516
exactly how should ns have described the difference in between an Interface and also an abstract class?
hot Network inquiries much more hot concerns

inquiry feed
subscribe to RSS
concern feed To i ordered it to this RSS feed, copy and also paste this URL into your RSS reader.


*

lang-java
stack Overflow
assets
company
stack Exchange Network
site style / logo design © 2021 ridge Exchange Inc; user contributions license is granted under cc by-sa. Rev2021.10.27.40585


Stack Overflow works ideal with JavaScript enabled
*

her privacy

By clicking “Accept every cookies”, friend agree stack Exchange deserve to store cookie on your device and disclose information in accordance through our Cookie Policy.