I have two classes with some common attributes : 

```
public class A { 
private String a;
private String b;
private String c;
// setters & getters
}
public class B {
private String a;
private String b;
private String c;
// setters & getters
}

```

Without hiretage , i want to create a generic method that can accept one of this two classes 

```
public <T> void myMethod(T object){
object.getC(); // "c" attribute of class A and B
}

```

How can i do this in java 8