Abstract class with no abstract functions

Discussion in 'C++' started by Uzytkownik, Apr 3, 2005.

  1. Uzytkownik

    Uzytkownik Guest

    I've class C1, C2 and C3. C1 should be abstract, and all functions
    should be defined like normal, no-virtual functions. It don't have to
    have constructor.
    C2 is C1 with constructor.
    C3 is C2 with constructor(both take long time and one exclude second)
    and additional functions and members.
    Haw do it, when I've not pure-virtual function?
    I use g++.
    Regards.
    --
    Linux user: #376500 (see http://counter.li.org/)
    Uzytkownik, Apr 3, 2005
    #1
    1. Advertising

  2. * Uzytkownik:
    > I've class C1, C2 and C3. C1 should be abstract, and all functions
    > should be defined like normal, no-virtual functions. It don't have to
    > have constructor.
    > C2 is C1 with constructor.
    > C3 is C2 with constructor(both take long time and one exclude second)
    > and additional functions and members.
    > Haw do it, when I've not pure-virtual function?


    class C1{ public: virtual ~C1() = 0 }; inline C1::~C1(){}

    However, there's something in that design description that sounds
    very bad.

    Perhaps you're using constructors where ordinary functions would
    be more appropriate?

    --
    A: Because it messes up the order in which people normally read text.
    Q: Why is it such a bad thing?
    A: Top-posting.
    Q: What is the most annoying thing on usenet and in e-mail?
    Alf P. Steinbach, Apr 3, 2005
    #2
    1. Advertising

  3. Uzytkownik schrieb:
    > I've class C1, C2 and C3. C1 should be abstract, and all functions
    > should be defined like normal, no-virtual functions. It don't have to
    > have constructor.
    > C2 is C1 with constructor.
    > C3 is C2 with constructor(both take long time and one exclude second)
    > and additional functions and members.
    > Haw do it, when I've not pure-virtual function?
    > I use g++.
    > Regards.


    What exactly do you want to achieve? If all you want is to prevent
    instantiation of C1, add a protected empty inline default ctor. If
    that's totally off your problem, it might help if you provided some code
    to clarify what you want to do and where exactly your prolem is.

    Cheers,
    Malte
    Malte Starostik, Apr 3, 2005
    #3
  4. Uzytkownik

    Uzytkownik Guest

    Alf P. Steinbach wrote:
    > * Uzytkownik:
    >
    >>I've class C1, C2 and C3. C1 should be abstract, and all functions
    >>should be defined like normal, no-virtual functions. It don't have to
    >>have constructor.
    >>C2 is C1 with constructor.
    >>C3 is C2 with constructor(both take long time and one exclude second)
    >>and additional functions and members.
    >>Haw do it, when I've not pure-virtual function?

    >
    >
    > class C1{ public: virtual ~C1() = 0 }; inline C1::~C1(){}
    >


    It's work.
    Thanks.

    --
    Linux user: #376500 (see http://counter.li.org/)
    Uzytkownik, Apr 3, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matthias Kaeppler
    Replies:
    1
    Views:
    421
    R.F. Pels
    May 22, 2005
  2. Sameer
    Replies:
    4
    Views:
    574
    Roedy Green
    Aug 31, 2005
  3. Iyer, Prasad C

    Abstract Methods & Abstract Class

    Iyer, Prasad C, Oct 20, 2005, in forum: Python
    Replies:
    0
    Views:
    527
    Iyer, Prasad C
    Oct 20, 2005
  4. Gerald Klix

    Re: Abstract Methods & Abstract Class

    Gerald Klix, Oct 20, 2005, in forum: Python
    Replies:
    1
    Views:
    335
    =?iso-8859-1?B?c+liYXN0aWVu?=
    Oct 20, 2005
  5. Replies:
    4
    Views:
    802
    Rolf Magnus
    May 17, 2006
Loading...

Share This Page