Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Child of 'concrete' child of abstract class is abstract...

IDKIDK Member Posts: 1,784
If I first define an abstract class:
[code]
class A {
virtual void func() = 0;
}
[/code]

And then make a child to that:
[code]
class B:A {
void func();
}
[/code]

And then make a child to that class:
[code]
class C:B {
}
[/code]
That class becomes abstract, becouse func isn't implemented...

My first Q is then, shouldn't it 'not' be abstract?

Or actually, my compiler says it can't find C::func()...
Which is kind of odd...

This is the actuall error message: (which is inside a much more complex peice of code, but I think this is the prob anyway...).
[code]
lang error LNK2001: unresolved external symbol
"public: virtual void __thiscall TreeReg::genAsm(void)"
([email protected]@@UAEXXZ)
[/code]

My second Q is how should I make it work?
I can add the function, but I can't remember how to call the parents class func...

[code]
void C::func(){
reinterpret_cast(this)->func();
}
[/code]
How do I do make it not to call itself?

My documentation doesn't cover any of this, but (ok, maybe the last one, but it doesn't cover a solution). I'll need some bether docs, can anyone recomend any good?

Comments

  • BitByBit_ThorBitByBit_Thor Member Posts: 2,444
    Try something like B::func()

    PS: Are you making a disassembler (or atleast something with asm? :P)

    Best Regards,
    Richard

    The way I see it... Well, it's all pretty blurry
  • IDKIDK Member Posts: 1,784
    : Try something like B::func()
    :

    But how do I specefy the object? Or don't I have to?

    No I didn't, thanks!

    : PS: Are you making a disassembler (or atleast something with asm? :P)
    :

    It's a compiler actually... And I think it's the coolest compiler ever thought of, but that's just my opinion, I think everyone else will think it sucks...

    I just managed to make it spit out some code...
  • BitByBit_ThorBitByBit_Thor Member Posts: 2,444
    :
    : It's a compiler actually... And I think it's the coolest compiler
    : ever thought of, but that's just my opinion, I think everyone else
    : will think it sucks...
    :
    : I just managed to make it spit out some code...

    What language? :P
    I'm busy making a disassembler myself - once you know how it's actually very easy (because assembly code is quite one-on-one with machine code).

    Best Regards,
    Richard

    The way I see it... Well, it's all pretty blurry
  • IDKIDK Member Posts: 1,784
    :
    : What language? :P

    I'm gonna call it Coda, it's a lnaguage I'm designing...
    It got some interesting features that I think is really cool...

    It's a long way to go, but some of the features are constant optimisation, (like a = 1+2 becomes a=3, but more advanced, like a=func(1,3), which evaluates it and then makes something like a=3 if func is constant), forced inlineing and good automatic inlineing...
Sign In or Register to comment.