128 Topics
|
|
|
Hi I'm having issue of understand how to **echo** a variable when the `class` is `extended`. I have **2** files. This is my **index.php** file: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>OOP Example</title> <?php include("class.php"); ?> </head> <body> <?php $mitch = new person("Mitch Last"); echo "Mitch's full … |
In this example, what's the difference between creating a class variable from the "class Employee" & creating an object from the class GenQueue ?! What's the difference in uses and implementation? import java.util.LinkedList; class GenQueue { private LinkedList list = new LinkedList(); public void enqueue(E item) { list.addLast(item); } public … |
|
|
Hi, I'm learning OOP and I'm having issue echoing an `attribute` function. This is my example: <?php class sandwich { function sandwich($hero) { echo "I like to eat $hero sandwich.<br>"; } } $a = new sandwich("roast beef"); $b = new sandwich("pastrami"); $c = new sandwich("turkey"); ?> When I echo it … |
|
Hi, I want to know how did I came up with this error when I run my code: `Trying to get property of non-object in line 19.` What does it mean? I want to echo out `My favorite candy is M&M Peanuts.` But instead I echo out `My favorite candy … |
Evening All, I am looking to start a class that dynamically creates a sitemap.xml on command and if possible auto uploads to google. The only thing is all the scripts i have come across by searching google tend to be using static pages. My links are dynamic and are also … |
|
I want to create a word processor. It seems like a useful project because I have strong feelings about how modern big word processors like MS Word and Open Office don't do things right, so my solution is to make one with more modest features but with the huge advantage … |
|
with a lil bit of change in code ,it's functioning, but I want it to function with data members being private :-/ #include<iostream.h> #include<conio.h> class account{ public: int account_number; float balance; int passw; public: void display() { cout<<"Account number is:"<<account_number<<endl<< "Account balance is:"<<balance<<endl; } void user(int acc, float amou, int … |
|
I am not new to OOP I am tidying up a very large site of mine and trying to create a much better structure (more in keeping with the whole point of OOP). I have decided to use mysqli (please don't suggest PDO as I have decided againast it) which … |
|
i need help with the punctuation check box. there's no supposed to be punctuation when it's not check. Im using netbeans. ![new](/attachments/large/3/new.jpg "new") here's my code ![neww](/attachments/large/3/neww.png "neww") |
|
i am having a problem, i downloaded the project from dev to my local, though it is running fine on dev but on local, it says me the following error Fatal error: Class 'DB' not found in F:\xampp\htdocs\timesheet\index.php on line 9 my index.php is <?php session_start(); error_reporting(1); include_once('classes/db.php'); include_once('classes/functions.php'); //========================================== … |
|
Hi all, I am working on a generic form validation class. However I have hit a stubling block. Form fields will never be the same from user to user. Is there a work around for this? Would it be easier to use numerical values for field names and use multiple … |
|
class Dog { public void bark() { System.out.println("Dog bark"); } } class Hound extends Dog { public void bark() { System.out.println("Hound bark"); } public void sniff() { System.out.println("Hound sniff"); } } public class CastingMethodCall { public static void main(String r[]) { ((Dog)new Hound()).bark(); //((Dog)new Hound()).sniff(); } } On executing above, … |
|
class Mixer { Mixer() {} Mixer(Mixer m) { m1 = m; } Mixer m1; public static void main(String args[]) { Mixer m2 = new Mixer(); Mixer m3 = new Mixer(m2); m3.go(); Mixer m4 = m3.m1; m4.go(); Mixer m5 = m2.m1; m5.go(); } void go() { System.out.println("hi"); } } The answer … |
|
Hi guys, I've made a class with a lot of functions, and for the 99% of the time i need the __construct functi. How can i call the class without the __construct ? class Test { public function __construct() { echo "bla"; } } $test = new Test(); What I … |
|
hi there guys can anyone here provide me with a guide on how to create an enrollment system in cSharp the OOP way? I just want to create it for a school project. Please help me I really need it if someone can provide me one I'd be very thankful … |
|
Hi all and thanks in advance for your help ! I have a very simple class called circle and i wanna add the ostream << so i can have the ability in main to write cout<<a<<b<<c; the theme is i'm getting many compile errors in the same row eg iso … |
|
I cant display this output..how i can i declare the gender n relate it with my price..i stuck here..oop c++ i have 2 coding for this..which 1 is better..im new in this progrmmer.. void eSalon::priceCurling() { cout<<"\nYour Gender is: "<<gender; if (gender=female) { cout<<"Long Hair Rm30-RM49"<<endl; cout<<"Short Hair RM50-RM100"<<endl; } … |
|
Guys I have some questions please help me., 1. if I make a tetris game out of c# will it be difficult to do? 2. Is it possible to finish it in less than a week ? 3. Also what should I use as a game studio? OpenGL, XNA or … |
|
It's useless. Why are stupid classes in C++ having private members for? [snip] I am never using OOP in C++ I'm just using structs to organize data fuck OOP and classes it's so ridiculous to me that I'm SMH |
|
Hi, I'm receiving an error message but cannot solve the problem. Please give us a hand. Line 49 is -> `$record_set = $this->db_conn->query($sql);` Thanks in advance `Fatal error: Call to a member function query() on a non-object in C:\wamp\www\oop_singleton_pattern\class.db.php on line 49` <?php class DatabaseClass { CONST HOST = 'localhost'; … |
|
package edu.edusys.demo.jdbc.dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; import java.util.ArrayList; import edu.edusys.demo.jdbc.bean.Customer; public class CustomerDAO { private Connection connection; public CustomerDAO(Connection connection) { super(); this.connection = connection; } public boolean addCustomer(Customer customer) throws Exception { String sql = "INSERT INTO Customer" + "(name,address,phone)" + "VALUES (?,?,?)"; PreparedStatement ps … |
|
Without the name, it runs fine. I read up that adding const before new could solve my problem, but it doesn't. Any ideas? include <iostream> include <string.h> using namespace std; class Player { int Health, *Strength, *Speed, *Accuracy, *Defense; char *Name[80]; public: Player (char, int, int, int, int, int); ~Player … |
|
Hello, Suppose I have a chess game. I make a nice class to handle an entire player's pieces: [CODE]class c_ChessTeam { private: // all pieces derive from class c_ChessPiece c_Rook Rook[2]; c_King King; c_Queen Queen; c_Bishop Bishop[2]; c_Knight Knight[2]; c_Pawn Pawn[8]; public: . . . };[/CODE] But what if I'm … |
|
Hey, I am a programmer in PHP Procedural and have just applied for a new job to further my career as a PHP Programmer, however they said it's advised to learn PHP OOP... so I have been watching some tutorials about PHP OOP and it just looks like OOP is … |
|
Hey guys, what the best practice for session check without duplicate code. I mean when check the session in some controller I have to duplicate the code to other controller, and that is not a good idea. <?php [CODE]class Ctrl extends Controller { private function _ses_check() {...} } class Second_ctrl … |
|
Hello, Am not new to PHP but new to OOP, I have watched lot of tutorials for oop and as I saw, class is almost a new language!! To be a pro programmer, I should learn existing class attributes or I should create my own?? example of default class attribute: … |
|
Hey guys, I know this will have an easy answer, but I have been awake far too long to see it :P I am doing some coding with classes in python, and it just isn't working. Here is the code: [CODE] from bpy import * from os import * from … |
|
[CODE] <?php class Database { public function protect($data){ $data = trim($data); $data = stripslashes($data); $data = strip_tags($data); $data = mysql_real_escape_string($data); return $data; } } $database = new Database(); $txt = '<strong>\\\Test///</strong>'; $txt = $database->protect($txt); echo $txt; [/CODE] And output have a <strong> tag, slashes and all with zero errors. I … |
|
very dificult oop, exception, inheritance task pleas. sorry, i'm hope you understand me. |
|
|
Hi all, been dipping my toe into OOP and am getting on OK, but I'm hitting a bit of a wall with a current project. classes: db (a PDO extended class) User Timetable The db is just a few shorthand ways of running PDO The User is just for handling … |
The End.