Member Avatar
Inheritance with generic types can sometimes be tricky. If you would inherit from a Stack<double>, no problem, but what if you want to keep it as generic as possible? Maybe it's a bad idea, but I wrote something like ... and in Stacker I implemented some arithmetic methods like divide …
by ddanbe 2,364 in Software Development ()
Member Avatar
I have a Task class (superclass) which inherited PracticeTest class(childclass). I'd faced question regarding my pass year question. In fact, we are allowed to declared like this ... But i wonder why we are doing this way? Thanks for advance explanation.
by gahhon 13 in Software Development ()
Member Avatar
Is it possible to let an overridden method from a base class to return the type of the derived class? What I mean is: ... Tried different things myself, but as I'm a still a learner and could find nothing useful on the web, I'm a bit stuck. Hope someone …
by ddanbe 2,364 in Software Development ()
Member Avatar
Hi guys, I would like to discuss my design with one query. below is the code snippet. It is clear from below code snippet that class pd is privately derived from AbstractClass as both are different classes and there is no relation between them.Now in my class pd i need …
by can-mohan in Software Development ()
Member Avatar
Hi fellow members, I have wrote two abstract classes, with the second inheriting from the first. However, I receive this error when I try to compile: "error C2143: syntax error : missing ',' before '<'." Will somebody help me out? Thanks! ...
by VengefulToast in Software Development ()
Member Avatar
Member Avatar
Member Avatar
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: ... …
by Maritimo 15 in Software Development ()
Member Avatar
Hey everybody, As of this moment i'm trying to work out how to approach a state design. I've come accross Source Makers' site ([ ... ) 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 …
by Tycellent in Software Development ()
Member Avatar
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 functions …
by aanchal_1 in Software Development ()
Member Avatar
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.
by theashman88 36 in Software Development ()
Member Avatar
I have two classes A Dog class whose constructor does not accept arguments, whose constructor does not accept any arguments and whose constructor accepts one argument I need to pass an E type argument to super() inside the constructor of the Dog<pet> class. How can I do this without passing …
by Pyler in Software Development ()
Member Avatar
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 …
by samson.dadson.3 in Software Development ()
Member Avatar
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 …
by asadmoosvi in Software Development ()
Member Avatar
This is, obviously a scoring category for a yahtzee game. This one specifically handles the score someone would get should the achieve a yahtzee. There are 7 other scoring category classes that are very similar. In fact! isDone(), getScore(), getDice(), getDisplayName(), and setDone() are the same for each of the …
by tyler.dahle in Software Development ()
Member Avatar
This started out as and now it has turned into a . Consider the following example: This results in (obviously): So my question: How do I resolve method conflicts in traits? Is it possible to achieve overlapping trait "inheritance"? If so, what is the "right" way to do this? Why …
by Gaetane 12 in Web Development ()
Member Avatar
Hello, I am working on an event driven library and am having one minor problem. Basically I have two ways to get what I want done. Method 1: Smart pointers and factory functions Method 2: Clone function I tend to prefer method 1 (it looks cleaner, and is less prone …
by Labdabeta 182 in Software Development ()
Member Avatar
And the error is $ gcc -std=c++11 -std=c++0x -W -Wall tt1.cpp /tmp/cc6aQime.o:tt1.cpp:(.text+0x79): undefined reference to std::ios_base::Init::Init()' /tmp/cc6aQime.o:tt1.cpp:(.text+0x94): undefined reference to std::ios_base::Init::~Init()' /usr/lib/gcc/x86_64-pc-cygwin/4.8.1/../../../../x86_64-pc-cygwin/bin/ld: /tmp/cc6aQime.o: bad reloc address 0x1b in section `.text$_ZN4BaseC2Ei[_ZN4BaseC2Ei]' /usr/lib/gcc/x86_64-pc-cygwin/4.8.1/../../../../x86_64-pc-cygwin/bin/ld: final link failed: Invalid operation collect2: error: ld returned 1 exit status Can anybody throw a light on the …
by skyyadav in Software Development ()
Member Avatar
Hello, I am having a particularly nasty case of "What is the syntax?" while working on an event driven library. Basically this is what I want: So that this code: Will pass an object to f() whose onEvent function consists of: Is this even possible? If it is, what would …
by Labdabeta 182 in Software Development ()
Member Avatar
I get an error that says "Person" is an ambiguous base of "StaffST"
by kruschev in Software Development ()
Member Avatar
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 In the method above (plus(T something)) I …
by Pyler in Software Development ()
Member Avatar
Hey guys, slightly less noob programmer here for a some more help, This week in class we were assigned to create a phonebook with a couple functions to manipulate it, but it seems I am having a couple problems. It seems to me that I have most of the program …
by Jugottabe in Software Development ()
Member Avatar
Hey guys i am having trouble with creating a Parent class(gameobject) for two other child classes(player,location) both of the child classes can access data from the parent class, and work well independently but once i include the h file for the child classes together in main.cpp i get the compiler …
by Stpdoug in Software Development ()
Member Avatar
Hi Guys, I am trying to teach myself templates and I keep getting lost in all these compilation errors. Here is the latest What am I doing wrong here? Any help would be much appreciated.
by abhimanipal 91 in Software Development ()
Member Avatar
Hey guys, noob programmer here. Over the last week or so we've been learning about classes and inheritance in my latest progamming class. I've recieved a variation of the ever so popular poker program and am having some problems putting it all together. I haven't had the opportunity to test …
by Jugottabe in Software Development ()
Member Avatar
I have the following structure: My main function: As you can see, i want to explicitly call them.
by tanatos.daniel in Software Development ()
Member Avatar
Hello, I have a chain of inherited classes like this: Based on that you can see that the public can only read the values in those classes, they cannot write them. However I would like to make a sort of overriding class that will allow those with access to it …
by Labdabeta 182 in Software Development ()
Member Avatar
Member Avatar
<?php class contacts { public $name; public $cno; public $clocation; public function __construct($name,$cno,$clocation) { $this->name = trim($name); $this->cno = trim($cno); $this->clocation= trim($clocation); } public function getName() { return $this->name; } public function getNO() { return $this->cno; } public function getLocation() { return $this->clocation; } } class DataBaseAction extends contacts { …
by kiLLer.zoh_1 in Web Development ()
Member Avatar
Hi. I have some css that needs to go into a large amount of websites. It generally contains very simple like all new elements with very unique names that will not be matched by anything these websites currently contain. The problem I am having is that some of these sites …
by asif49 9 in UI / UX Design ()