+ 5
Little help please
Question is --> Class Beta inherit from class Alpha. The constructor of class alpha displays "a". While the class beta Constructor displays "b". What is the output on the screen when the code below is run: Alpha a = new Beta(); //the answer has to be 'ab' according to Sl's lesson qn. Below is my attempt i didn't get it right. https://code.sololearn.com/c6h4wrAOok3j/?ref=app
4 Respostas
+ 3
Please read the task carefully, it says (quoted)
"The constructor of class Alpha displays 'a'. While the class Beta constructor displays 'b' ..."
In your code, neither Alpha or Beta class had a constructor defined. Instead you have created a void Display() method which was not required by the task.
Just create a constructor for each class, and print 'a' or 'b' in respective class constructor, accordingly. No need for Display() method.
+ 5
Ooooh okay thanks Ipang let me try
+ 4
Thanks again Ipang solved it
https://code.sololearn.com/cT4A16rgmYN0/?ref=app
+ 2
Good job Kapama, Joshua 👍