58 Solved Topics

Remove Filter
Member Avatar for
Member Avatar for Doogledude123
Member Avatar for Tycellent

Hey everyone, Got 2 questions here that i'm hoping will be answered. Say i have 2 variables int iValue; int iValueArray[300]; and later on init. them in the constructor Banana::Banana(): ival(0), ivalArray() {} 1. What would the ivalArray() indicate? Would it be the same as initializing every element to null/empty? …

Member Avatar for Tycellent
0
325
Member Avatar for SkateX

Greetings, I'm working on a class project for fractions and I'm stuck and cannot figure out where to go from here. We have a mandatory driver file we aren't supposed to change. See below for example output and the output I am actually getting. **Sample Output** Enter numerator; then denominator. …

Member Avatar for Nutster
0
527
Member Avatar for NoobCoder85

Here is my code: ` #include <iostream> #include <iomanip> #include <string> using namespace std; class Register { //Private members private: //Creating an array for all the Prices static double Price[]; //Declaring RegNUM and RecNUM int RegNUM, RecNUM; //Print out Item name in a loop static string items[]; //Creates a Receipt …

Member Avatar for David W
0
368
Member Avatar for NoobCoder85

The tools Hal’s sells are: Hammers: $10.99 Wrenches: $10.99 Levels: $19.99 Tape Measures: $4.99 Screwdrivers: $8.99 In order to make things easier in the long run you have decided to make a c++ program that takes in all the orders for each register and tallies them at the end of …

Member Avatar for NoobCoder85
0
1K
Member Avatar for humorousone

Kind of stuck here. I'm porting over a section of code from Java to C#, and I'm having an issue with method permissions constructors. Early in my code, i have this class.. public class TCard { int suit; int rank; } and later i've got this method, which throws a …

Member Avatar for humorousone
0
24K
Member Avatar for nathan.pavlovsky

Hello programmers! I have been working on a hardware store application, where there is a `HardwareRecord`class that stores information about each object in a store (ex: nuts, bolts, screws, and so forth). Here's my declaration of this class: // HardwareRecord.h // Initialize Hardware Store File // // // Definition of …

Member Avatar for nathan.pavlovsky
0
20K
Member Avatar for Damian_2

Okay so inside my ArcherArmor.cpp, I'm trying to figure out why the map initializer list isn't working, but for some reason I keep getting "Error C2593: 'operator =' is ambiguous". Here is my code: I also have a class which ArcherArmor is derived from, that has a struct called `Armor`, …

Member Avatar for Damian_2
0
741
Member Avatar for Deegirl

Hello, is this how a constructor is created and initialized. I am getting an error; VB does not like the "New" what I am trying to do is to create a constructor with one argument and initialize its attribute. Public Sub New(ByVal newProdNumber As Long) intProdNumber = newProdNumber End Sub …

Member Avatar for chuchaykaw
0
213
Member Avatar for Pyler

I'm trying to create a list stack that implements some interface called SomeList The list stack should only use stack with no links. the itnerface has a number of methods that I would like to implement. So for SomeList I have something like public interface SomeList<T>{public void plus(T something);public E …

Member Avatar for JamesCherrill
0
402
Member Avatar for dreking6

am a python beginner, receeently started learning about classesand i wrote this got this little code that keeps bringing this error . please i need someone here to help debug it: class employee(): ` empcount=0` def _init_(self,name,salary): self.name=name self.salary=salary employee.empcount=+1 def displaycount(self): print 'Total employee: %d' %employee.empcount def displayemployee(self): print …

Member Avatar for dreking6
0
6K
Member Avatar for gabriel.riveraperossenkopp

I need to write a code with a constructor class in order to see the whole phonelist using an array that reads from a document txt, able to add a person and phone number, search just one person in the phonelist and able to modify their phone number. here is …

Member Avatar for elhkei
0
686
Member Avatar for xHellghostx

I am having a problem to understand how class inhertance works in Java.. Now I want to get information from a class to another and let's say we have class A and class B class A contains a string an int and a byte class B contains a String and …

Member Avatar for stultuske
0
281
Member Avatar for MRehanQadri

We cannot use constructors if we want that whenever a pointer is declared, it should be NULL. Am I right Sir? if I declare student *head, *tail, where student is a class, can I make my pointers automatically make NULL using default constructor?

Member Avatar for Moschops
0
167
Member Avatar for xHellghostx

For example let's say we have the property called Customer that returns a value of name String name; <== Global Variable public String getName() { return name; } public String setName(holdingName) { name=holdingName; } and a constructor called Match public FullName(String realName) { holdingName = realName; } Can I do …

Member Avatar for stultuske
0
314
Member Avatar for xHellghostx

So I am working on a program and it has two seperate classes.. One of them contain the forum layout and the other contain some calculations and totals.. The problem is that the class with the calculations contain a constructor and other functions that I need to pass from this …

Member Avatar for tinstaafl
0
306
Member Avatar for phfilly

Hi all! I just have a quick question about the execution of a copy constructor. This is the code i'm testing my work with as I'm busy learning for a test. Class file: Clock :: Clock (int h, int m, int s) { hr = h; min = m; sec …

Member Avatar for can-mohan
0
290
Member Avatar for ambageo

Hi! I am supposed to write a programm for making a window.First of all, I must make a window with some given default values. Below is the code that I have been given as a template public class Window { private String name; private int height; private int width; private …

Member Avatar for ambageo
0
208
Member Avatar for challarao

hi all, In the book "Programming Languages-Pragmatics" second edition by Michael l. Scott and Morgan Kaufmann, there is a sentence while explaining about copy constructor: "In recognition of this intent, a single-argument constructor in C++ is called a copy constructor." This is about the constructor of the form foo::foo(const foo& …

Member Avatar for mike_2000_17
0
1K
Member Avatar for challarao

Hi all, I came to know that in Java or c++, constructor is executed only after the allocation of space.... Then what does an implicit default constructor(in c++) or default constructor in Java does....? If we explicitly define our constructor then the initialization will be done according to our needs! …

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

class Sample1 { Sample1() {System.out.println("Sample1 const"); } void doStuff(){System.out.println("sample1 dostuff"); } } class Sample2 extends Sample1 { Sample2() {System.out.println("Sample2 const"); } } public class Sample3 extends Sample2 { Sample3() {System.out.println("Sample3 const"); } public static void main(String r[]) { new Sample3().go(); } void go() { super.doStuff(); } } The output is: …

Member Avatar for rahul.ch
0
195
Member Avatar for daino

My initial thoughts on the default constructor are that it was called automatically. From what I can see, it seems that this is so but a constructor called automatically doesn't initialize int or char variables for exampe, to Zero as I originally thought. It appears that they initialize the variable …

Member Avatar for vijayan121
0
293
Member Avatar for Pyler

I wanted to write a simple program that uses classes but I've been running into errors. Anyone have a clue as to what is wrong with my code because I can't seem to figure it out. #include <iostream> #include <iomanip> #include <cmath> using namespace std; class cone{ private: double radius; …

Member Avatar for Rashakil Fol
0
248
Member Avatar for grh1107

currently I'm rewriting old euler solutions into classes so i can store them in a library. I wrote a program that digitizes a number so it can check to see if it a pallindrome, The base class digitize dynamically allocates memory for the size of a number and stores each …

Member Avatar for mike_2000_17
0
247
Member Avatar for emidevil

Hi. im kinda new here . i just want some help with this code i cant seem to figure out my problem, i already declared a constructor but it keeps on saying cannot find symbol when i compile it -_- import javax.swing.JOptionPane; import java.io.*; public class Sample_Thread { public static …

Member Avatar for DavidKroukamp
0
568
Member Avatar for Eragah

[B][I]Hi I wanted to ask a quick question. I have two classes. And within my main class i am able to pass in variable to three variables EyeColorR to EyeColorB and able to send them the my Eye Class under the consturctor class Eye. the catch is I need to …

Member Avatar for Eragah
0
212
Member Avatar for creative_m

I wonder why they use private constructors.when I was navigating java documentation I found alot of classes with private constructor.Would you tell me what are the benefits of writting them.

Member Avatar for creative_m
0
466
Member Avatar for Goshutu

Hi, i am doing a multiple-file project and i come across a difficult obstacles. I want your help, DaniWeb readers on this problem, which i find very strange: [CODE] #include "stdafx.h"//i have included vector header here #include "globals.h" #include "functions.h" using namespace std; #ifndef CPIECE #define CPIECE class CPiece { …

Member Avatar for Goshutu
0
331
Member Avatar for divsok

Suppose the xMethod() is invoked in the following constructor in a class, xMethod() is _________ in the class. public MyClass() { xMethod(); } A. a static method B. an instance method C. a static method or an instance method what is the answer a or b or c

Member Avatar for stultuske
0
1K
Member Avatar for SSight3

I've tried searching for articles that relate to this issue, but all I keep finding are articles about people who don't know how to define constructors/can't call the parent constructor/etc and I think this will cut straight to the chase. The problem code is as follows: [CODE] #include <stdio.h> class …

Member Avatar for SSight3
0
279

The End.