462 Topics
| |
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]); | |
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 … | |
| 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 … |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
#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}; … | |
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 … | |
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 … | |
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 } … | |
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 … | |
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 … | |
how do I run a python class without creating an object | |
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) { … | |
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 … | |
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? | |
Hi Guys Could you explain me why adult education classes are mandatory for childrens? | |
| 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) … |
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 … | |
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`, … | |
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 … | |
I wish to use parameters in a class to change what the class displays how would this be done? | |
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. | |
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 … | |
# 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 … | |
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 … |
The End.