Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Predmet
- {
- public int ocena;
- }
- public static void Main(String[] args)
- {
- Predmet predmet = new Predmet();
- //Za ocenu je unesen nevalidan podatak, ali nemamo nikakav mehanizam preko kog mozemo da sprecimo pogresan unos
- predmet.ocena = 11;
- }
- public class Predmet
- {
- private int ocena;
- public void SetOcena(int ocena){
- if(ocena < 5 && ocena < 10) return;
- this.ocena = ocena;
- }
- }
- public static void Main(String[] args){
- Predmet predmet = new Predmet();
- //Unesen je neispravan podatak, ali nece narusiti integritet informacionog sistema jer smo u samoj klasi sprecili prosledjivanje neispravnog unosa
- predmet.SetOcena(11);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement