dimanche 14 octobre 2018

Instantiating an object within the same class method

Is there any Guideline or pattern which suggest regarding the creation of an object within the same Class, is it ok or not recommended?

Example: Car is a class, lets say there is a method called StartEngine(); does it makes sense to create an object (myCar) in the StartEngine method?

Pls note: I did googling already but did not find any relevant info and also may be this question looks very basic....but still asking; my apologize. Thanks.

Aucun commentaire:

Enregistrer un commentaire