Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

can not find symbol symbol: construtor product()  RSS feed

 
numan ahmad
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm moving your post to a mode appropriate forum.

Please UseCodeTags the next time you want to post some code. Formatting the code properly would help to read it too.

Posting something else than the code would help too. For example, the complete stack trace of the error. In the sales class, you are calling super(productcode,price,productname), but there is no such constructor in the product class. (class names usually start with a capital letter).
 
Pramod P Deore
Ranch Hand
Posts: 633
Android Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Error says all things. Compiler can't find the constructor which takes argument as


In product class you had written constructor as


so change/add proper constructor in Product class and also check the same for customer class.
 
numan ahmad
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for pointing my mistake but sorry i did not get you properly please explain where i am wrong ?
 
Pramod P Deore
Ranch Hand
Posts: 633
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when you call constructor/create object first super class constructor runs. In your case your super class constructor doesn't match argument. It means suppose you have a 2 classes as





Then here in child class there is constructor which takes only one argument as String. But in parent class Constructor takes argument as String and int. Parent (String name,int age) . So you must have to add constructor in Child class who has argument as String and int. like



same case in your program. In your progam in product class you had written constructor as


And in Sales class inside constructor you are providing only 3 argument as



Instead of that it requires 7 argument. Hope now it is clear to you.

 
numan ahmad
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot sir now it is clear ..
 
Pramod P Deore
Ranch Hand
Posts: 633
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are Welcome.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!