Author Topic: constructor - problem  (Read 399 times)

Offline Anfängerin12345

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
    • View Profile
constructor - problem
« on: March 10, 2016, 01:32:02 PM »
hey i have a question:

so i have a scalafile lets call it
class button{
val m : M = ...
val ar = new AR(m)
println(ar.doSomeStuff)  //all works fine

//here i want to create:      val tr : TR = new TR(ar)
so far so good, over ar._ i can use all function which are defined in class AR{ //eg. def doSomeStuff=... }
now i want to create an other class TR{}, which should be in the same project but NOT in the same package. TR should use the function like i would do in the button class with ar.doSomeStuff. (in button class its working)
for that i thought i need to create a class like the following.

class TR(val ar: AR){

def anything = ar.doSomeStuff

but the problem is, in the button class it says that
val tr = new TR(ar) is not a constructor.

as its in the same project but not in the same package i tried to do the following...
suppose class TR{} is in package First

before using the constructor i tried to do: import First._  (which should import anything in the package First, right?)
does someone know why?? do i need to do something with an object? but for objects there are no parameters.....


Offline scottjenkins

  • Newbie
  • *
  • Posts: 9
  • Karma: 0
    • View Profile
Re: constructor - problem
« Reply #1 on: March 22, 2016, 09:47:08 AM »
This seems to be Scala the programming language.  This forum is for Scala the Digital Signage Solution.