difference between widening and narrowing in c++?
hi.... difference between widening and narrowing in c++? what is mean by casting and what is types of casting? ...
hi.... difference between widening and narrowing in c++? what is mean by casting and what is types of casting? ...
Are there any tools that will expand object oriented code so there is no sharing of any kind? For example if I have two classes A and B which inherit C then the tool would adjust classes A and B to no longer use C. It would also be nice if the tool did this and it still compiled and produced the same results. I think the main difficulty ...
A couple of questions: q1: IN OOP PHP, what is the best way for a child class to make use of a var set by the parent class, and to set a variable in the parent class. What I want to do is run a function in the child class, that uses one of the variables in the parent class. I have done it by setting the variable I want to access as pu...
I'm working on my first real MVC application and I'm trying to follow general OOP best practices. I'm refactoring some simple business logic that I had in a controller into my domain model. I've been doing some reading lately and it seems pretty clear that I should put the logic somewhere in a domain model entity class in order to avoid ...
I just want to know how I can call certian classes in design pattern here, like which type are they classified in OO design (1) I use a class that has just named constants , this class is used directly other classes to get values of constants in it.I dont instantiate the class. (2) I use a class with full of static methods, this class ...
I've been searching for this and can't quite get to what I need. Is anyone aware of an open source forum script written in PHP that utilizes OOP concepts? So has to be Forum OOP Open source I will accept answers for anything else, including tutorials, videos, etc. since I get to still see the source and learn from it. ...
Reading the book I found the following: The way of thinking when you model the problem by its single elements its the base of objected oriented programming. Also when I want to make a game (e.g.), the player is one element, the level is one element? Those are just basic elements which my application logic consists of? It also says ...
I am developing some project. And I want to control different errors. I know that in all popular frameworks and php projects there are different Exceptions. But I think that is not required work. If the error is occured we can make die() with our message. 1. What are the main pluses of Exceptions? 2. Can I control my errors with die()? ...
Hi I'm new to OOPS, Can you guys suggest me which way is better to call a function of a class in PHP and why? the scenario is as follows. class A { function B (){} } Which method will take less resource to call the function B 1. A::B(); or 2. $obj = new A(); $obj->B(); ...
If I have this code, the string "test" is echoed. This is in PHP 5.3. Is this some oversight that shouldn't be relied on, or is it some way of achieving multiple inheritence in PHP? class Test1 { function getName() { return $this->name; } } class Test2 { public $name = 'test'; function getName() { ...
Hi, In any programming environment,what ever the data type I am going to choose finally the CPU will do only the Arithmetic operations(addition/logical operations). How this transition(from user defined data type/operations to CPU instruction set) happens and what is the role of compiler,interpreter,assembler and linker in this life cy...
If I don't mark a method as virtual, will it be available to a derived class? If using object a, I make changes to method of base class. Then object b accesses the same method m1() of the base class (which is available to derived class). Will it print those changed value by object a? Will they share common method ? class A { pub...
Hello guys, I'm working on a simple class right now to get my head around OOP and i need some help with a function that i'm creating. The function receives various parameters, being some of those optional. For example: public function Test($req, $alsoreq, $notreq = null, $notreq2 = null, $notreq3 = null) { // blah blah } My ...
Hello guys, I'm working on a object-oriented system and i would like to know what is the best way of handling a user login system, using sessions, under a OO model. Any good examples? Should i use autoloader? ...
I'm building a MySQL query "interface". It will allow me to make selects more easily. However, i'm having a doubt about passing empty parameters. Some of my function parameters are not required, so, i'm passing them empty. For example: query('table', '*', '', '', '0,10'); Being: query($table, $from, $where, $orderby, $limit) Is this...
Hello guys, Hope you can help me with this one: i have two classes: Database and Users. The Database connects to the database using PDO (inside the constructor) and has functions to alter tables, insert data, etc. The Users class will handle login, as well add/remove users. However, the Users class needs to connect to the database. How ...
i have the following classes. class base { private function __construct(){ //check if foo method exists //$this->foo(); // if it exists } public static function singleton(){ if(!isset(self::$singleton)){ self::$singleton = new base(); } return self::$singleton; } } ...
I'm receiving the following error message while trying to call a method from a Singleton class, inside another class. Any ideas? Call to a member function query() on a non-object. ...
This may be the wrong approach, but as I dig deeper into developing my game engine I have ran into a timing issue. So lets say I have a set of statements like: for(int i = 0; i < 400; i++) { engine->get2DObject("bullet")->Move(1, 0); } The bullet will move, however, on the screen there won't be any animation. It will basically "...
What are the advantages of OOP subtyping over typeclasses, if any? In other words, now that we have typeclasses, is there any reason to still use OOP subtyping? PS: I am a Scala programmer. ...