This question is closed. Reopen it to edit or answer.
How can i acess to created objects out of the class
1 view (last 30 days)
Hello. I have a simple Class:
function this = Packung(p,m,l)
this.preis = 0;
this.menge = 0;
%this = this.setPreisMenge(p,m);
function this = setPreisEinkaufswagen(this, p)
xxx = this.preis;
% Objekt2 = setPreisMenge(Objekt2, 2, p);
function [this,objekt] = setPreisMenge(this,objekt, p,m)
this.preis = p;
this.menge = m;
objekt.preis = objekt.preis + 100;
now i have another function, in which i want to make a for loop, going through all the objects created from my Class Packung. How to do this?
I tired following: Function PriceProducts is NOT in the Class. Before i started the Function, i made a object from the class: Milch = Packung (1,2,3)
Though i get an error, Undefined function or variable 'Milch'.
How to manage this? I'd like to predifine all the Objects that need to be used, and then i want to loop them.