Need help on pure virtual method

This is a discussion on Need help on pure virtual method within the C++ Programming forums, part of the General Programming Boards category; Hi Guys I need to implement an abstract base class shape containing following pure vitual methods - void draw() const; ...

  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    6

    Need help on pure virtual method

    Hi Guys

    I need to implement an abstract base class shape containing following pure vitual methods

    - void draw() const;
    -ostream &print(ostream &o) const;

    can anybody help me with it

    I tried following is it correct?

    [class Shape
    {
    public:
    Shape()
    {
    }

    virtual ~Shape()
    {
    }

    virtual void draw() const = 0;
    ostream & print(ostream &o) const = 0;
    };

    ]
    Thanks

    Wanex
    Last edited by wanex; 03-23-2006 at 06:01 PM.

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,637
    post the code you're having trouble with.
    Code:
    if( numeric_limits< byte >::digits != bits_per_byte )
        error( "program requires bits_per_byte-bit bytes" );
    24bbs.cpp

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    7,317
    Looks fine to me.

    Code tags look like this:
    [code]
    Your code here.
    [/code]

  4. #4
    Registered User
    Join Date
    Mar 2006
    Posts
    6
    thanks man

  5. #5
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,066
    Quote Originally Posted by Daved
    Looks fine to me.
    Quote Originally Posted by wanex
    thanks man
    That might possibly be the easiest help you've ever given, Daved.
    Sent from my iPadŽ

  6. #6
    Registered User
    Join Date
    Apr 2003
    Posts
    2,662
    I remember this homework assignment. It was that famous tutor/paid cheat that posted the requirements.

  7. #7
    Registered User
    Join Date
    Mar 2006
    Posts
    6
    Well I am a student, do you remember as well if there was any solutions for that assigment?

  8. #8
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,066
    Quote Originally Posted by wanex
    Well I am a student, do you remember as well if there was any solutions for that assigment?
    As a person that was given this assignment when I was in this class... I can tell you that, yes... there is a solution.
    Sent from my iPadŽ

  9. #9
    Registered User
    Join Date
    Apr 2003
    Posts
    2,662
    Well I am a student, do you remember as well if there was any solutions for that assigment?
    Well, it sounds if as you are a cheater too. Here's an idea: how about you actually do the programming yourself?

  10. #10
    Registered User
    Join Date
    Mar 2006
    Posts
    6
    Quote Originally Posted by 7stud
    Well, it sounds if as you are a cheater too. Here's an idea: how about you actually do the programming yourself?
    I already done and submited it, I was just curious if there was any alternative/better solutions for it. whats your problem anyway?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 10-28-2009, 09:25 AM
  2. Replies: 48
    Last Post: 09-26-2008, 03:45 AM
  3. Pure Virtual Function - Virtual Method Table
    By u_peerless in forum C++ Programming
    Replies: 8
    Last Post: 06-07-2008, 01:19 AM
  4. Information Regarding Pure Virtual Functions
    By shiv_tech_quest in forum C++ Programming
    Replies: 6
    Last Post: 01-29-2003, 03:43 AM
  5. C++ XML Class
    By edwardtisdale in forum C++ Programming
    Replies: 0
    Last Post: 12-10-2001, 10:14 PM

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