Skip to main content

All Questions

Filter by
Sorted by
Tagged with
1 vote
1 answer
45 views

Contrasting solutions for visibility when inheriting from base class templates

In the following code will fail to compile because, despite the chain of public inheritance, HasFlag is not visible in DerivedFoo. class BasicFoo { public: bool HasFlag() const { return m_flag; } ...
Adrian McCarthy's user avatar
3 votes
1 answer
3k views

error: static assertion failed: template argument must be a complete class or an unbounded array

I'm deriving from a base class in which I try to define a type. That type is dependent on itself via a variant, so it would require to know the memory layout of the base class upon definition. However,...
glades's user avatar
  • 5,244
0 votes
2 answers
621 views

Get template parameter of derived class from base object

In short: I have a base class A_base without template parameters and a derived class A that has two. The function foo() only accepts base class objects foo() is supposed to return an object which has ...
glades's user avatar
  • 5,244
3 votes
2 answers
161 views

Why can't a typedef type be used to declare its parent class' ctors? [duplicate]

template<typename> struct A { int n; A(bool) {} }; template<typename> struct B { struct C : A<B> { using Base = A<B>; using A<B>::A;...
xmllmx's user avatar
  • 44.4k
11 votes
2 answers
160 views

Why does public overload conflict with private using directive on some compilers?

I came across the following situation in one of my projects, where a base class has a function template, which is hidden by a non-templated function in a derived class template. Further down the ...
pah's user avatar
  • 323
53 votes
3 answers
4k views

Why doesn't a using-declaration work to solve the diamond problem?

Please consider the following code: struct A { void f() { } }; struct B1 : A { }; struct B2 : A { }; struct C : B1, B2 { void f() // works { B1::f(); } //using ...
gd1's user avatar
  • 11.4k
0 votes
2 answers
1k views

Using directive in Derived Class changes inheritance to Public

A very simple question but yet confusing: Why does a using directive change the inheritance!? This compiles with Comeau. I have read that a using directive (decleration?) makes the variable public, ...
Gabriel's user avatar
  • 9,542
1 vote
5 answers
732 views

Inheriting from classes

In C#, how many classes can you inherit from? When you write: using System.Web.UI; is that considered inheriting from a class?
DNR's user avatar
  • 3,766