On the program I'm writing I have a class RestrictedUser and class User that is derived from RestrictedUser. I'm trying to hide the User specific methods by casting to RestrictedUser but when I do the casting the User methods are still available. Also when I run the debugger the type of the variable comes up as User.
RestrictedUser rest...
I have the following contrived example (coming from real code):
template <class T>
class Base {
public:
Base(int a):x(a) {}
Base(Base<T> * &other) { }
virtual ~Base() {}
private:
int x;
};
template <class T>
class Derived:public Base<T>{
public:
Derived(int x):Base<T>(x) {}
Derived(Derived<T>* &other): Base<T>(other) {}
...
I have a class called Resource, this is inherited by a class called ResourceMeta
I need to upcast ResourceMeta to Resource without it still thinking it is a type of ResourceMeta.
When I try to save my object using entity framework, it will complain about mappings not existing, rightly so because it will be trying to save ResourceMeta r...
My objective is to do a deep copy of a class, but a virtual class is causing trouble.
#include<iostream>
using namespace std;
class Vir//pure virtual class
{
public:
virtual void hi()=0;
};
class Handler:public Vir
{
public:
int i;
Handler() {}
Handler(int val):i(val) {}
void hi() {cout<<"Value of i="<<i<<e...