jeudi 9 novembre 2017

Best approach to make class design if we have two class as bellow :

Best approach to make class design if we have two class as bellow :

    Class Teacher {
var name
var age
var TechId
    }

    Class Student {
var name
var age
var StdID

    }

I try it using that :

    Class Person {
var name
var age

    }
     Class Student : Person{

var StdID

    }
     Class Teacher : Person {

var TechID

    }

But Now problem is that student become teacher and vice versa.

Can you any one provided best solutions for that using Swift ?

Aucun commentaire:

Enregistrer un commentaire