462 Topics

Member Avatar for
Member Avatar for redtribal23

Why this doesn't work? class Faculty extends Employee { private long[] officeHours; private String rank; public Faculty(long[] hours, String rank) { this.officeHours = hours; this.rank = rank; } public static void main(String[] args){ //some code here Faculty f = new Faculty(newToken[], tokens[tokens.length-1]);

Member Avatar for vivekH
0
255
Member Avatar for Maritimo

One of my students make me a question (which answer i know) but I think could be instructive to formulate the same question here so many people can learn about it. The question is: How to implement a copy assignment into a Derived class? Consider the following class A: class …

Member Avatar for pritaeas
0
393
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 moaz.amin.37

i read adapter classes everything is write but i am confuse about Listener Interfaces and Adapter classes concept priblem is that when java create adapter classes it implements corresponding interface and privide defination with empty bodies of all methods that are present in interface this is declaration public class WindowAdapter …

Member Avatar for moaz.amin.37
0
502
Member Avatar for theashman88

I know this has been asked before, but I can't find any simple answers for a noob like me in C#. What exactly is a static method. I mean what does it mean to be static vs. nonstatic. I know in the code with the main method we use `public …

Member Avatar for RichardGalaviz
1
306
Member Avatar for Tycellent

Hey everybody, As of this moment i'm trying to work out how to approach a state design. I've come across Source Makers' site [http://sourcemaking.com/design_patterns/state/cpp/1](http://sourcemaking.com/design_patterns/state/cpp/1) and am testing out the example. The program works fine when it's all in 1 file, although i had to change some stuff in main, but …

Member Avatar for rubberman
0
3K
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 aanchal_1

this program is simply for recording data of various staffs.Inheritance has been used for taking additional data.Staff is the base class.the classes officer,typist and teacher are the derived classes.again the classes regular and casual are derived from the class typist. **now my problem is that whenever i call the constructor …

Member Avatar for aanchal_1
0
280
Member Avatar for theashman88

I'm trying to create a program that passes arguments of size of three shapes, a circle, a triangle, and a rectangle. I got those but everytime I run the code it displays the arguments as 0 instead of giving me the shape dimension. Here is the code. using System; class …

Member Avatar for kvprajapati
0
289
Member Avatar for Rootz

I am not sure why my program isn't writing to the text file. When I start the program it tells me that the file opens. Then I call the functions that are inherited from other classes and I would assume that it would write to the file and then display …

Member Avatar for Ancient Dragon
0
252
Member Avatar for software girl

#include<iostream.h> #include <stdlib.h> //FOR exit(1) struct Flight { char flightNo[5]; char date[12]; char time[6]; char gate[3]; }; Flight flight={"AB11","10-12-2008","20:30","RT"}; struct Seat { char name[40]; char booking_ID[3]; int seats; }; Seat choice[4][5]; void displaymenu(); void booking(); void seat(); void ticket(); void records(); void menu(); void exit(); //Variables int selection,i,j,password; int seats_num[20]={0}; …

Member Avatar for Ancient Dragon
-1
283
Member Avatar for Kristian_2

Hi guys, I have small problem with my example code. Any hint? #include <iostream> using namespace std; class A{ public: int a; A(int i){a = i;} A(const A& rhs) // copy constructor { a = 2; } A(const A&& rhs) // move constructor { a = 3; } }; void …

Member Avatar for mike_2000_17
0
425
Member Avatar for Brandon_6

You cannot determine whether a ctor is being called on an object that is to become const. Such as: const Foo bar( another_foo ); // no way to determine in the ctor that bar will be const I'd like some sort of function attribute for copy constructors to determine if …

0
158
Member Avatar for Pyler

I have two classes A Dog class whose constructor does not accept arguments, `public class Dog<pet> extends Animal<pet>{}` whose constructor does not accept any arguments and `public class Animal<pet>{}` whose constructor accepts one argument public class Dog<pet> extends Animal<pet>{ public Dog(){ super(/*what should go here?*/); //Constructor accepts no arguments } …

Member Avatar for stultuske
0
241
Member Avatar for samson.dadson.3

please i have a little problem creating a class and making it run. The class is created separately as a header file with it's source code. whenever i build the source code of the class, i get an error that says: undefined reference to 'WinMain@16'. And whenever I run the …

Member Avatar for samson.dadson.3
0
428
Member Avatar for asadmoosvi

I have been programming for quite a while in Python but have just started to learn OOP properly. I find it really confusing and I don't really understand it. Especially the implicit self that python automatically passes. It just isn't clicking, really. May someone provide an easy explanation of what …

Member Avatar for vegaseat
0
324
Member Avatar for tutsie12
Member Avatar for <HHH>

Hello every one, What i need to do is to make an array of my own class and then assign values to that array I made an array and when i try to assign value it gave me an exception Your support is highly appreciated. static void Main(string[] args) { …

Member Avatar for <HHH>
0
390
Member Avatar for C

I had a programme to write for college in Java. I have missed the class so I won't be getting marked on it but wanted to get it done as I have an exam next we. I am really stuck. I have to create a costInsurance () method taking in …

Member Avatar for C
0
323
Member Avatar for garyndeborah.kuhre

Trtying to figure out how to add 5 different methods into this class when the program already does all that is required but my prof will knock me if I dont put them in here, do thet need to be put in as private?

Member Avatar for C-Money
0
283
Member Avatar for idmaporg
Member Avatar for Encheiridion

hi, done some work is not finished yet but this two versions\stages are runable. and what is very helpfull, to read opinion, suggestion, critic, ideas, feelings about. here is the link: http://softwareconstructor.webs.com/ and i need to read what u think about two firsts: * tryout2 (10bm) * and tryout1 (190mb) …

Member Avatar for Jorge Cordeiro
0
192
Member Avatar for Damian_2

Okay so I have a class `Student`, which takes a number and a vector as a parameter for the constructor. Everything works well, until I output the values of the vector for every instance. The problem is that the same vector is being shared with EVERY instance I create, but …

Member Avatar for rubberman
0
433
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
744
Member Avatar for Damian_2

Okay so I have an `inventory` class that accesses a static vector from my base class `MainShop`. I also have a `SwordShop` class which inherits from `MainShop`. (Both Inventory and SwordShop are derived classes). //SwordShop class void SwordShop::Shop { //I have a setter function where it takes an integer and …

Member Avatar for Damian_2
0
337
Member Avatar for CodingCabbage

I wish to use parameters in a class to change what the class displays how would this be done?

Member Avatar for rrashkin
0
272
Member Avatar for CodingCabbage

I have these few lines in a class in my program but it doesnt appear. No errors are shown and when i "print(menubar)" and address "0.4.." or "4..." appears menubar = Menu(master = self.mainGUI) fileMenu = Menu(menubar) fileMenu.add_command(label="Exit", command= destroyMethod) menubar.add_cascade(label="File", menu=fileMenu) destroy method does work and is existing.

Member Avatar for CodingCabbage
0
305
Member Avatar for triumphost

Creating WinAPI windows and controls can be a pain and quite difficult/annoying at times. Most of the time, I find myself searching MSDN, DaniWeb, and StackOverflow. I hate having to use external libraries unless I absolutely have no other choice. Below contains code for creating WinAPI windows, Controls, Sub-Classing, and …

Member Avatar for mike_2000_17
0
4K
Member Avatar for mike_2000_17

# Introduction # The subject of this tutorial is a bit more advanced than the subjects I have tackled in the past, but I hope this will find some interested readers. From time to time in C++, programmers find themselves torn apart between using a *Generic Programming* style which primarily …

2
2K
Member Avatar for tyler.dahle

package hw3.categories; import java.util.ArrayList; import hw3.DiceGroup; import hw3.api.IScoreCategory; /** * Scoring category for a yahtzee. A DiceGroup * with N dice satisfies this category only if all N * values are the same. For a dice group that satisfies * this category, the score is a fixed value specified in …

Member Avatar for JamesCherrill
0
226

The End.