Ok, I'm using virtual functions, overloaded functions, and multiple inheritance. Of course this doesn't turn out well.
The scenario: Class base1 has a virtual function that needs to be specified by its child.
Class derived derives from two parents base1 and base2, and should use base2's existing functionality to define base1's virtual ...
Given a sequence of assemblies with classes eg.
AssemblyA
Customer
AssemblyB
Customer : AssemblyA.Customer
AssemblyC
Customer : AssemblyB.Customer
Given the name (not taken care of namespace) Customer, can I use LINQ to query against the sequence of assemblies
to find the customer at the bottom of the inheritance cha...
Hi All,
I'm having trouble creating a model for a couple entities that is sane in both Hibernate and the Database. Any help is appreciated.
A company entity and table exists, which provides both a company name and a "company code". The company code must be unique.
Company's may act as 2 different entities, clients or partners.
We'd ...
I've messed up something.
Here is the code:
#include <iostream>
class connection_c {
private:
std::string data_;
void (*saveCallBack_)();
public:
connection_c(std::string &data) : data_(data) { std::cout << "ctor: " << __FUNCTION__ << ":" << data_ << std::endl;}
void registerCallBack(void(*cb)()) { saveCallBack_ = c...
I'm trying to start using Unit Testing on my current project in Visual Studio 2010. My class structure, however, contains a number of interface and abstract class inheritance relationships.
If two classes are derived from the same abstract class, or interface I'd like to be able to share the testing code between them. I'm not sure how t...
My delegate doens't seem to accept a subclass, I think an example is the easiest.
public class A
{
public A() { }
}
public class B : A
{
public B() { }
}
public class Program
{
private delegate void CallBack(A a);
private static CallBack callBack = new CallBack(Test);
public Main(string[] args)
{
...
I have a object that inherits from TabItem. I have a bunch of Database objects that will reuse the same code so I wanted only one TabItem class and then use DataTemplates to control how each object gets presented.
Problem is that the TabItem shows a collection of Objects and ObservableCollection is concrete.
I've pondered a few solutio...
I have several classes that inherit from an abstract base class that holds some common utility code. I want to move to EF for data access but I'd still like the objects to inherit the common code in the base class. The EF classes already inherit from EntityObject so I can't have them inherit my base class. What's the right way to handle ...
I have a main class that has a Sub procedure with no implementation. Any derived class should override and implement this procedure, so I used MustOverride in the base class.
Now, any time this procedure is called, I need to set a specific Boolean variable to True at the beginning of the procedure and set it to False at the end.
Is the...
I have this code and I want to keep it elegant.
I got stuck at this inheriting issue and I would have to mess up the code if I do.
Help me keep it elegant. I don't mind making changes anywhere up and down the hierarchy; feel free to change the core.
I have these abstract classes (I omitted unrelated implementation to keep the question ...
I'm trying to do almost exactly the same thing as this post:
http://colinjack.blogspot.com/2008/03/nhibernate-working-around-lack-of.html
but I can't get the suggested solution to work for me.
Essentially I have one main class, which has a reference to an abstract class. The abstract class has several implementations. I want the comm...
struct A {
protected:
int y;
public:
int z;
};
struct F : A {
public:
using A::y;
private:
using A::z;
};
int main() {
F obj_F;
obj_F.y = 9;
obj_F.z = 10;
}
Source: http://publib.boulder.ibm.com/infocenter/comphelp/v7v91/index.jsp?topic=/com.ibm.vacpp7a.doc/language/ref/clrc14cplr135.htm
In the above code obj_F.z = 10;...
Is it safe to do the following or is it undefined behaviour:
class Base
{
private:
int a;
};
class Derived : public Base
{
private:
int b;
};
Base x;
Derived y;
x = y; // safe?
Do the extra bits in derived classes just get sliced off?
...
I have a base class
class Animal
with pure virtual functions, and a set of derived classes
class Monkey : public Animal
class Snake : public Animal
I want to implement a comparison operation so that, if I encounter two pointers to Animals in my code
Animal* animal1
Animal* animal2
I can compare them to each other. The compar...
Why Child class doesn't have echo() method?
Parent = function(){
this.name = 'abc';
}
Parent.prototype.echo = function(){
alert(this.name);
}
Child = function(){
$.extend(this, Parent);
}
var x = new Child();
x.echo();
What should I do to inherit from parent class in Javascript?
...
Is it possible to use a method from the parent class in the overwritten version in its child in javascript?
...
I have an existing application in C++ with a custom ArrayBase class that manages storage and access to a contiguously allocated region of memory. I have a separate ItrBase class that is used to access data in that ArrayBase. ArrayBase has a createItr() function that currently returns an ItrBase object.
I need to extend ArrayBase to us...
This may be a silly question but I haven't found any information on it.
Let's say several of the classes in my program derive from 'MySubView' which is derived from another class, UIViewController.
I would declare it like this:
@interface NewViewController : MySubView {
// code ...
}
@end
In the future the client wants a change,...
I have a base class and a class inheriting base. The base class has several virtual functions that the inherited class may override. However, the virtual functions in the base class has code that MUST to run before the inherited class overrides get called. Is there some way that I can call the base classes virtual functions first then th...
I am trying to inherit a set of different parent class and even not inherit any class but as per some condition.
For example, Here is what I would like to do
$choice = 2;
switch($choice) {
case 1:
class child extends parent1
break;
case 2:
class child extends parent2
break;
default:
...