abstract classes 1

This is a discussion on abstract classes 1 within the C++ Programming forums, part of the General Programming Boards category; Just getting into these and have a few questions. First, it looks to me like when you're creating these, you ...

  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    242

    abstract classes 1

    Just getting into these and have a few questions.

    First, it looks to me like when you're creating these, you declare as pure virtual methods (with virtual ... = 0 exactly those methods that you insist be redefined in every derived class, right?

    And you of course declare just as good ole public methods in the abstract class those that should apply to every derived class and hence don't need to be repeated (?).

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    exactly those methods that you insist be redefined in every derived class, right?
    Well, every derived class that is to be instantiated. You can always have an abstract class inherit from another abstract class in which case some of the pure virtual functions in the base class may not be overridden.

    And you of course declare just as good ole public methods in the abstract class those that should apply to every derived class and hence don't need to be repeated (?).
    Correct. Of course the functions don't need to be public...
    bit∙hub [bit-huhb] n. A source and destination for information.

  3. #3
    Registered User
    Join Date
    May 2009
    Posts
    242
    Cool, thanks! ... both for clarifying the rule and pointing out the exceptions to be aware of.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with abstract classes
    By DavidP in forum C# Programming
    Replies: 1
    Last Post: 08-18-2008, 03:03 PM
  2. Operators of abstract classes
    By Thanuja91 in forum C++ Programming
    Replies: 1
    Last Post: 11-02-2007, 05:30 AM
  3. Abstract classes
    By cisokay in forum C++ Programming
    Replies: 17
    Last Post: 05-29-2005, 09:39 AM
  4. Replies: 7
    Last Post: 03-10-2004, 03:10 PM
  5. Purpose of Abstract Classes
    By luckygold6 in forum C++ Programming
    Replies: 15
    Last Post: 04-29-2003, 06:24 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21