462 Topics
| |
Is it possible to pass arrays into a function and/or return an array from a function? I think it's possible but I don't really know how to go about it. lets say I have a function that returns a bunch of field from a database ex: [CODE]function a($sql){ $result = … | |
Hello It's me again, some might have seen a similar string, and it is probably because it is the same, but with a different problem. The following shows a program which uses a function that converts Fahrenheit into Celsius. The problem is that a person can enter any value they … | |
Hi all, I've finally gotten a handle on object-oriented programming (it took ages), and I really like it. But I'm still struggling with conceptualizing some things. For example, if I want to make a form using objects, do I make a Form class with a method like startFORM($name_of_action_page, $method), then … | |
This is my first post here on Daniweb and I intend to do things right. I actually did read the "READ THIS FIRST" thread and instead of posting 500 lines of code I whipped up a test program I aptly titled test.cpp First I will walk you through my problem. … | |
Just started learning java and i'm having a little trouble with my compiling im supposed to give a screen shots of my outputs if it works but vista is blocking it (asks for permission and then just hangs) ive included the questions just in case its being bleh but it … | |
I have a design question which I have not been able to find a satisfactory answer for by searching. Essentially, I have a class - Base - that contains a vector of pointers to another class - Node. However, I would like to be able extend both the Base and … | |
copy constructors ?? what are they ? | |
I got stuck at this error: [B]cannot find symbol symbol: variable BankAddress location: class Bank bankAddress = BankAddress;[/B] [COLOR="Red"]<------pointing at BankAddress;[/COLOR] I'm trying to instantiate an object of Address, calling the constructor of the Address class to create an object of Address. I'll post both classes, Bank and Address [B]Address … | |
Here's the prompt guys: Assignment #4 will be the construction of 2 new classes and a driver program (the class containing a main method). [B]Address class[/B] The Address class describes cpu of a bank. It has following attributes: Attribute name Attribute type Description city String the city of the bank … | |
I'm writing two classes for the main program code. I'm stuck trying to do figure out how to instantiate an object of the class Address: [B]Address class:[/B] [CODE]public class Address { private String city; private String state; public Address() { city = "?"; state = "?"; } public Address(String aCity, … | |
Hi, I have a map of a base class object (not pointer to objects). I did this because I need to have inheritance from others types like this: Parameter RealParameter: Parameter IntParameter: Parameter ... My problem is that when I am going to insert in the map, copy constructur of … | |
Is it possible to call a constructor if we entered know value in the output screen ??? example !! [CODE]import java.io.*; class Employee{ int num; static int count=0; float compensation; public void print(){ System.out.println ("Employee number: " + num + ", Employee Compensation: $" + compensation); } public Employee(){ num … | |
I got to assignment first one was to print the data of two students using different classes and constructors and count the total numbers of records and i've done this. here is the program. [CODE]public class Student { int RollNo; String name; static int stdcount=0; public void print(){ System.out.println ("Roll … | |
I just wanted to demonstrate a quick point regarding Constructors & inheritance. Look at these two classes and think about what you might expect to see after the main method has run. Notice that ClassB is a subclass (inherits from) of ClassA. So, what do we expect the output to … | |
It may seem like a simple answer, but how do I pass an image to a bitmaps constructor. for example: [CODE]Bitmap bmp = new Bitmap(########);[/CODE] what would I put in place of the pound signs If i wanted the default image to be C://Users/Me/Documents/Visual Studio 2010/Projects/MyProject/Image.jpg Please help. | |
Hey there, I need some help with the placement of constructors and how the second constructor would work (there's two of them). All I ask is for some explanation. These are the exact instructions: The default Constructor should build a dynamic array of size 3 for the grades. Another constructor … | |
take following class and two object definitions: [CODE=c++] class Rect{ public: enum centimeter; enum meter; Rect(double len,double wid,enum centimeter){ length=(len/100); width=(wid/100); } Rect(int len,int wid,enum meter){ length=len; width=wid; } //rest of implementation private: double length;//in meters double width;//in meters }; Rect obj1(10,5,Rect::centimeter()); Rect obj2(10,5,Rect::meter());[/CODE] two previous constructors have dummy enum … | |
I have recently learned in school about the dreaded diamond.And I wrote a program using virtual inheritance to overcome the problems.I use g++ and I have the following errors with this program, [CODE]//doing to create an illustration for dreaded diamond #include<iostream> using namespace std; class vehicle { public: virtual void … | |
take two following classes and their constructors as samples: [CODE=c++] class One{ public: One(int a,int b):adad1(a),adad2(b){} private: int adad1; int adad2; }; class Two{ public: Two(int input[]){ for (int i=0;i<10;i++) araye[i]=input[i]; } private: int araye[10]; };[/CODE] considering objects with static storage duration, I think first constructor can be applied during … | |
Suppose we have following two classes: [CODE=c++] class Temp{ public: char a; char b; }; class Final{ private: int a; char b; char c; public: Final(Temp in):b(in.a),c(in.b){} //rest of implementation };[/CODE] can we initialize an object of the Final class with following syntax in upcoming c++0x standard: [CODE=c++] Final obj(Temp{'a','b'});[/CODE] | |
I have tried to create a simple class where the program passes a name and telephone number to my class type and then prints it to the screen. It tells me I have undeclared identifiers, but I am constructing my program just like an example we did in class. Can … | |
hi guys what constructors should i use for this program? [CODE]using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BACKUPEXEFILES { public class cCOPY { private string _directorypath; private string _filename; public string directorypath { get { return _directorypath; } set { _directorypath = value; } } public string filename … | |
Hi, A bit of a tricky question, so I will try to explain everything in its fullest. I am trying to replicate some of the Terrarium work done by the Microsoft guys, but I dont want to look at any of their code. Anyway I have my base class which … | |
I was wondering how one would go about creating a structure that cannot be used by itself, i.e. only through a wrapper class. My question is what would be the syntax for this construct? I'm currently on a personal project to make simple tests from old tests, all the questions … | |
Ok, so I'm trying to make a constructor for a text-based game for a monster. Here is the code for it: [CODE]public class Methods { String name; //characteristics of monsters int bodyPoints, mindPoints, attack, defense; public Monster(String name, int bodyPoints, int mindPoints, int attack, int defense) { this.name=name; this.bodyPoints=bodyPoints; this.mindPoints=mindPoints; … | |
[CODE]class A extends B { C ob1=new C(); D ob2=new D(); protected void finalize() { System.out.println("Finalizing A"); super.finalize(); } public static void main(String ss[]) { new A(); System.gc(); } }[/CODE] Though System,gc() doesn't guarantee the running of finalization, my question is if the JVM is able to run the finalizations … | |
Why is the constructor called from top to bottom rather than bottom to top ???? | |
I need to code a program for my friend and it has been giving me some difficulties. This needs to have two classes, one called Tester and another called Game. And the data in the Game class needs to be pulled to the tester class after the calculations are finished. … | |
In a nutshell I am trying to write a program that will connect to a database, query several tables for various sets of data that will then be transformed into XML that is stored into a file on the local hard disk. My first thought process to solve this problem … | |
When i run this, i get an error message saying TYpe expected and it points to the line having a.drive(100)... Any help please? Newbie... [code] class Car { public Car(){ int odometer=0; System.out.println("Car constructed!"); } public void drive(int miles) { System.out.println("Driving....."); odometer+=miles; } public long odometer; } class Guzzler extends … |
The End.