Re: Calling an object from another in PHP using construct Programming Web Development by aishamushtaq To avoid infinite loops when including objects of multiple classes in PHP OOP: 1. Use dependency injection to pass objects as dependencies. 2. Review class design for circular dependencies. 3. Refactor classes to break cyclic dependencies if necessary. Re: minimal-mvc: Frugal PHP micro-framework with basic routing and templating Programming Web Development by Dani … not lost on me that what I'm describing are classes that are unique to my implementation, and obviously one wouldn…'t create a micro-framework with Post and Forum classes built-in. However, you proposed that weblogs or forums would… Re: minimal-mvc: Frugal PHP micro-framework with basic routing and templating Programming Web Development by Dani … own ORM such that each instance of any of these classes maps directly to a row in a MySQL table of… the same name. Each of the classes has a push_to_db() method to commit changes to the object… Re: minimal-mvc: Frugal PHP micro-framework with basic routing and templating Programming Web Development by pyeri …, they ended up creating one Factory class and two other classes for request and response. While OOP certainly has its uses… Calling an object from another in PHP using construct Programming Web Development by FarrisFahad How can I include objects in each other using PHP OOP? I have 3 classes all classes make use of one another. I am trying to call them on `__construct` but it's creating an infinite calls to one another. How can I solve this? Re: Calling an object from another in PHP using construct Programming Web Development by Dani I'm not understanding your question. You can definitely create objects within the methods of other classes. As pritaeas says, please post some code so we can understand better. i need to transform specific code for mltiplr classes to GUI Programming Software Development by JILA if i provide you with my project OOP java can you transform him for me to GUI Re: Calling an object from another in PHP using construct Programming Web Development by pritaeas Show some code of how you expect it to work. Re: Calling an object from another in PHP using construct Programming Web Development by jkon In every OOP language that I know you can create infinite recursive loops in a construction method . Lets play a bit with it in PHP: class A { private $obj; public function __construct() { $this->obj = new B(); } } class B { private $obj; public … Re: Calling an object from another in PHP using construct Programming Web Development by FarrisFahad Hey, I know that this discussion is old but I need to know now. I am new to OOP in PHP. Is it good to call a class within a class? Why or why not? How should I create an object? I want objects to use other methods from other objects. Your example is good ... class A { private $obj; public function __construct… Re: Calling an object from another in PHP using construct Programming Web Development by pritaeas That causes an infinite loop as described by jkon. I'd go for a container class: ```php class Container { private $A; private $B; private $C; public function __construct($A, $B, $C) { $this->A = $A; $this->B = $B; $this->C = $C; } } $A = new A(); $B = new B(); $C = new … Re: Calling an object from another in PHP using construct Programming Web Development by Dani I feel like you're going to end up in an infinite loop if you create a new A from the constructor function of class A. Same with class B having `new B()` in its contruxtor, and and C having `new C()` in its constructor. Re: Calling an object from another in PHP using construct Programming Web Development by Dani Oh, sorry. I didn't see the post by pritaeas. Re: Classes Programming Software Development by rubberman Classes are used to model physical or conceptual entities. An example … class Animal - an abstract base class. Derived from that are classes such as Cat, Dog, Human, Bird, etc. Derived from Cat… model basic behaviors in the base classes, and then refine those behaviors in the derived classes. Example: all animals eat food. Some… Re: classes Programming Software Development by raheel.wa Classes divide your work in small chunks. For example you want to write a management for a university system, so in university there are teachers, students, staff.So you make a Teacher class that accept teacher data and another class should be student class that accept student data and so on...... :) Re: Classes vs Functions Programming Software Development by vegaseat Classes don't make functions obsolete. The beauty of Python is that you can go either way. It's up to you, if a class makes sense, use it. I use classes in most GUI programs, using inheritance is very common. Also, the program looks more organized and simply makes life easier. Re: Classes and objects Programming Software Development by griswolf Classes describe objects Objects hold data and do work If you … Classes Programming Software Development by Dani …it contains what are known as objects, such as classes and structures, which allow the easy manipulation of large …just as variables and encompass large amounts of data. Classes are generally declared prior to any functions in the…] [/indent][b]Abstraction[/b] A very large part of classes is the concept of abstraction, meaning that programs are not… classes Programming Software Development by game_fan … are also supposed to be inheritance classes for the different titles. The 2 derived classes should be a fiction one and a… non-fiction one. I m quite a begginer at classes so i'm not sure how to carry on! Any… Classes Programming Software Development by churva_churva Can someone suggest me what classes I can make in developing a system of a cell shop and also the attributes or the properties of each classes and what method of each classes I can do.... [QUOTE]I really need suggestion [/QUOTE] Re: classes Programming Software Development by gerard4143 … my program or whatever, I always want to define classes:P My question is simple --> are structures the… best way to "replace" classes? TY[/QUOTE] Well yes...if you think of structures as… classes without methods and constructor/destructors Well if you want… Re: classes Programming Software Development by Bench … next step is probably to write your Fiction and Nonfiction classes Re: Classes Programming Software Development by Narue …from C Structures are inherited from C, yes. >classes are the object-oriented, C++ alternative It's probably …new to avoid breaking changes with the "C with classes" preprocessor. Lo and behold, that early decision …gave C++ both classes and structures, for better or worse. >a teacher … classes Programming Software Development by Yee Hi! I have had to change from Python to C because of university instructions. My problem is that, when I want to make a menu for my program or whatever, I always want to define classes:P My question is simple --> are structures the best way to "replace" classes? TY Re: Classes Programming Software Development by Fbody … on a "base" or "general" cases/classes and "derived" or "specialized" cases…/classes. The properties of the base class are designed in such … applies to all objects of that class. Conversely, the derived classes are designed in such a way as to account for… Classes Programming Software Development by msqueen082 hello I wrote this code using classes and it keeps giving me the error message : a nullreference … have a method called getClientTransaction in the client class.(3 classes stock, transaction, and client). Whenever the click on the summary… Re: classes Programming Software Development by rubberman You did ask one question - what are nested classes? So, I will answer that. The other issues I assume … problems, and we don't do homework... Nested (inner) classes are classes declared/defined in the context of another (outer) class. They… Re: Classes Programming Software Development by CoolGamer48 … is because structs are left-over functionality from C, and classes are the object-oriented, C++ alternative. Initially, structs (if I… nice class things, like inheritance and access-level specifiers. When classes came around and got all of that, they added the… classes help Programming Software Development by iamthwee Does anyone have any links/ tutorials about writing complex classes. U know stuff like overloading operators, using friend function. Or am I best to get a book on this. If so which book is good . ThanQ classes Programming Software Development by Nemoticchigga …. I have all the forms, as well as some additional classes in source files for data storage. I was wondering how…