Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i dont know the input of this coding. can you help me?

What I have tried:

C#
public class Shape {  
	int x = 0; 
    public void draw() {      
    	System.out.println("Draw a shape");    } 
    public void displayX() {      
    	System.out.println(x);    } } 
 public class Circle extends Shape {   
 	int x = 1; 
    public void draw() {      
    	System.out.println("Draw a circle");    } 
    public void displayX() {      
    	System.out.println(x);    } } 
 public class Test {   
 	public static void main(String[] args) {     
 		Shape shape = new Circle();     
 		shape.draw();       
 		shape.displayX();    } }
Posted
Updated 3-Dec-16 21:55pm
Comments
Richard MacCutchan 4-Dec-16 8:04am    
You have tagged the question "C++", but that looks like Java to me.

1 solution

You wrote it: we didn't.
Which means that you have an idea what the code is meant to do, while we have no idea at all.
Even worse, we have no idea at all what your "inputs" should be - that code does not interact with the user in any way other than to output a couple of "place holder" text descriptions of which methods have been executed, without doing anything else.

I'd suggest you start by reading your homework question rather carefully - it's probably going to hold the info you need but we can't see that either - and then execute your code...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900