GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 26-Sep-2006, 22:33
nethravathi.mn nethravathi.mn is offline
New Member
 
Join Date: Sep 2006
Posts: 8
nethravathi.mn is on a distinguished road

Accessing constructors of a base class explicitly in the derived class


I need a clarification regarding the method used to access the base class constructor in a derived class constructor.

How can a scope resolution operator be helpful in this regard?
  #2  
Old 27-Sep-2006, 17:13
ubergeek ubergeek is offline
Regular Member
 
Join Date: Jan 2005
Posts: 775
ubergeek is a jewel in the roughubergeek is a jewel in the roughubergeek is a jewel in the rough

Re: Accessing constructors of a base class explicitly in the derived class


CPP / C++ / C Code:
class Base
{
     Base(int x) { m_xpos = x * 43; }
     int m_xpos;
};
class Derived : public Base
{
    Derived(int x, int radius) : Base(x), m_rad(radius) { }
    int m_rad;
};
I don't know where you'd need a scope resolution operator.
 
 

Recent GIDBlogObservations of Iraq by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Overloaded Constructors and Class within Class jdbrine C++ Forum 2 10-Jul-2006 22:14
a tester class and then some. postage Java Forum 1 06-May-2006 15:48
References to base class to access derived class only members mirizar C++ Forum 3 03-Dec-2005 20:40
calling abstract base class method calls draw instead achoo FLTK Forum 1 19-Dec-2004 09:38
Error C2146: syntax error : missing ',' before identifier 'C4' mattchew008 C++ Forum 2 19-Dec-2004 06:06

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 21:03.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.