Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trait Debug{
- def debugVars():Any = {
- val vars = this.getClass.getDeclaredFields
- for(v <- vars){
- v.setAccessible(true)
- println("Field: " + v.getName() + " => " + v.get(this))
- }
- }
- }
- class Point(xv: Int, yv: Int) extends Debug {
- var x: Int = xv
- var y: Int = yv
- var a: String = "test"
- }
- var p : Point = new Point(3,4);
- p.debugVars();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement