128 Topics

Member Avatar for
Member Avatar for LastMitch

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 …

Member Avatar for LastMitch
4
294
Member Avatar for sapure

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 …

Member Avatar for riahc3
0
228
Member Avatar for LastMitch

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 …

Member Avatar for LastMitch
0
142
Member Avatar for LastMitch

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 …

Member Avatar for LastMitch
0
1K
Member Avatar for Squidge

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 …

Member Avatar for Squidge
0
590
Member Avatar for bguild

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 …

Member Avatar for mike_2000_17
0
1K
Member Avatar for HunainHafeez

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 …

Member Avatar for HunainHafeez
0
183
Member Avatar for simplypixie

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 …

Member Avatar for simplypixie
0
2K
Member Avatar for ITshard

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")

Member Avatar for JamesCherrill
0
190
Member Avatar for baig772

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'); //========================================== …

Member Avatar for baig772
0
7K
Member Avatar for Squidge

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 …

Member Avatar for Squidge
0
201
Member Avatar for rahul.ch

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, …

Member Avatar for JamesCherrill
0
257
Member Avatar for rahul.ch

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 …

Member Avatar for sepp2k
0
258
Member Avatar for Szabi Zsoldos

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 …

Member Avatar for Szabi Zsoldos
0
138
Member Avatar for king03

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 …

Member Avatar for Akill10
0
128
Member Avatar for coutnoob

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 …

Member Avatar for histrungalot
0
344
Member Avatar for Miz_LiLO

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; } …

Member Avatar for ravenous
0
116
Member Avatar for king03

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 …

Member Avatar for thines01
0
218
Member Avatar for ObjectOriented

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

Member Avatar for Divyab
-1
304
Member Avatar for veledrom

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'; …

Member Avatar for veledrom
0
108
Member Avatar for alanborder

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 …

0
213
Member Avatar for stupendousomega

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 …

Member Avatar for raptr_dflo
0
160
Member Avatar for Chuckleluck

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 …

Member Avatar for mrnutty
0
180
Member Avatar for Danny159

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 …

Member Avatar for diafol
0
213
Member Avatar for gorleone

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 …

Member Avatar for pritaeas
0
162
Member Avatar for cmps

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: …

Member Avatar for cmps
0
112
Member Avatar for metalix

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 …

Member Avatar for metalix
0
271
Member Avatar for gorleone

[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 …

Member Avatar for diafol
0
142
Member Avatar for knowill
Member Avatar for raptr_dflo
0
230
Member Avatar for diafol

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 …

Member Avatar for diafol
0
210

The End.