class BankAccount{
private string name;
private double balance;
// Defualt constructor
BankAccount()
this.name = "";
this.balance = 0;
}
BankAccount(String name, double balance){
this.name = name;
this.balance = balance;
}
//whenever you are creating objects: these values will be assigned by defualt
// Getter function
public void setName(String name){
this.name = name;
}
// Setter function
public String getName(){
return name
How do attributes and methods work together
We have getters and setters
(as in example above)
When you are writing the code : you must have