* C++ class inheritance
@ 2003-10-02 4:00 Rafael Costa dos Santos
2003-10-02 7:30 ` Voicu Liviu
0 siblings, 1 reply; 6+ messages in thread
From: Rafael Costa dos Santos @ 2003-10-02 4:00 UTC (permalink / raw)
To: linux-c-programming
Can anyone explain me what does < > means ?
Example:
class RegistrationRequestPDU : public RasPDU<H225_RegistrationRequest>
{
} ;
Is "RegistrationRequestPDU" inheriting from RasPDU, H225_RegistrationRequest
or both ?
--
Rafael Costa dos Santos
rafael@thinkfreak.com.br
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: C++ class inheritance
2003-10-02 4:00 C++ class inheritance Rafael Costa dos Santos
@ 2003-10-02 7:30 ` Voicu Liviu
2003-10-03 12:57 ` Rafael Costa dos Santos
0 siblings, 1 reply; 6+ messages in thread
From: Voicu Liviu @ 2003-10-02 7:30 UTC (permalink / raw)
To: rafael; +Cc: linux-c-programming
Rafael Costa dos Santos wrote:
>Can anyone explain me what does < > means ?
>Example:
>
>class RegistrationRequestPDU : public RasPDU<H225_RegistrationRequest>
>{
>} ;
>
>Is "RegistrationRequestPDU" inheriting from RasPDU, H225_RegistrationRequest
>or both ?
>
>
>
RegistrationRequestPDU inherits from RasPDU using template H225_RegistrationRequest ?
--
Liviu Voicu
Assistant Programmer and network support
Computation Center, Mount Scopus
Hebrew University of Jerusalem
Tel: 972(2)-5881253
E-mail: "Liviu Voicu"<pacman@mscc.huji.ac.il>
/**
* cat /usr/src/linux/arch/i386/boot/bzImage > /dev/dsp
* ( and the voice of God will be heard! )
*
*/
Click here to see my GPG signature:
----------------------------------
http://search.keyserver.net:11371/pks/lookup?template=netensearch%2Cnetennomatch%2Cnetenerror&search=pacman%40mscc.huji.ac.il&op=vindex&fingerprint=on&submit=Get+List
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: C++ class inheritance
@ 2003-10-02 12:27 Sandro Dangui
0 siblings, 0 replies; 6+ messages in thread
From: Sandro Dangui @ 2003-10-02 12:27 UTC (permalink / raw)
To: rafael, linux-c-programming
RasPDU is a template.
If you look at its .h file you will see something like this:
template <class T>
class RasPDU
{
...
};
In your case, "T" will be replaced (compiler) by H225_RegistrationRequest.
In my opinion, tamplates are the most powerful feature of C++.
-----Original Message-----
From: Rafael Costa dos Santos [mailto:rafael@thinkfreak.com.br]
Sent: quinta-feira, 2 de outubro de 2003 01:00
To: linux-c-programming@vger.kernel.org
Subject: C++ class inheritance
Can anyone explain me what does < > means ?
Example:
class RegistrationRequestPDU : public RasPDU<H225_RegistrationRequest> { } ;
Is "RegistrationRequestPDU" inheriting from RasPDU, H225_RegistrationRequest
or both ?
--
Rafael Costa dos Santos
rafael@thinkfreak.com.br
-
To unsubscribe from this list: send the line "unsubscribe
linux-c-programming" in the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: C++ class inheritance
2003-10-02 7:30 ` Voicu Liviu
@ 2003-10-03 12:57 ` Rafael Costa dos Santos
2003-10-03 16:19 ` Darío Mariani
0 siblings, 1 reply; 6+ messages in thread
From: Rafael Costa dos Santos @ 2003-10-03 12:57 UTC (permalink / raw)
To: Voicu Liviu, Sandro Dangui; +Cc: linux-c-programming
Ok, but as I am C ANSI programmer it is a bit dificult to underestand.
Are you saying that "RasPDU" is a general class that depends on the template
(in this case "H225_RegistrationRequest") that is informed ?
Is it similar to create a specific class like:
class RasPDU : public H225_RegistrationRequest
{
} ;
and inherit from it ?
class RegistrationRequestPDU : public RasPDU
{
} ;
On Thursday 02 October 2003 07:30, Voicu Liviu wrote:
> Rafael Costa dos Santos wrote:
> >Can anyone explain me what does < > means ?
> >Example:
> >
> >class RegistrationRequestPDU : public RasPDU<H225_RegistrationRequest>
> >{
> >} ;
> >
> >Is "RegistrationRequestPDU" inheriting from RasPDU,
> > H225_RegistrationRequest or both ?
>
> RegistrationRequestPDU inherits from RasPDU using template
> H225_RegistrationRequest ?
--
Rafael Costa dos Santos
rafael@thinkfreak.com.br
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: C++ class inheritance
2003-10-03 12:57 ` Rafael Costa dos Santos
@ 2003-10-03 16:19 ` Darío Mariani
0 siblings, 0 replies; 6+ messages in thread
From: Darío Mariani @ 2003-10-03 16:19 UTC (permalink / raw)
To: rafael; +Cc: linux-c-programming
You better get a C++ book or tutorial, I can recommend you "The C++
Programming Language" by Bjarne Stroustrup, 3rd Edition.
With templates you can parameterize types used in C++ constructs like
classes, structs or functions.
Rafael Costa dos Santos wrote:
> Ok, but as I am C ANSI programmer it is a bit dificult to underestand.
>
> Are you saying that "RasPDU" is a general class that depends on the template
> (in this case "H225_RegistrationRequest") that is informed ?
>
> Is it similar to create a specific class like:
>
> class RasPDU : public H225_RegistrationRequest
> {
> } ;
>
> and inherit from it ?
>
> class RegistrationRequestPDU : public RasPDU
> {
> } ;
>
> On Thursday 02 October 2003 07:30, Voicu Liviu wrote:
>
>>Rafael Costa dos Santos wrote:
>>
>>>Can anyone explain me what does < > means ?
>>>Example:
>>>
>>>class RegistrationRequestPDU : public RasPDU<H225_RegistrationRequest>
>>>{
>>>} ;
>>>
>>>Is "RegistrationRequestPDU" inheriting from RasPDU,
>>>H225_RegistrationRequest or both ?
>>
>>RegistrationRequestPDU inherits from RasPDU using template
>>H225_RegistrationRequest ?
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: C++ class inheritance
@ 2003-10-03 21:18 IVAN DE JESUS DERAS TABORA
0 siblings, 0 replies; 6+ messages in thread
From: IVAN DE JESUS DERAS TABORA @ 2003-10-03 21:18 UTC (permalink / raw)
To: rafael; +Cc: Voicu Liviu, Sandro Dangui, linux-c-programming
Templates are like a C macros, but templates provide a more elegant form
to do things that normally you could do with C macros, in some way.
For example:
template <class T>
struct MyStruct
{ int x, y;
T* ptr;
}
Now you could define vars in C++:
MyStruct<int> myVar1OfTypeMyStruct;
MyStruct<float> myVar2OfTypeMyStruct;
You could do almot the same in C:
#define MyStructType(T) typedef struct { \
int x, y; \
T* ptr; \
} MyStruct_##T \
MyStruct(int);
MyStruct(float);
Now you could define vars in C like this:
MyStruct_int myVar1OfTypeMyStruct;
MyStruct_float myVar1OfTypeMyStruct;
A i said before is more elegant the C++ form!!!!!!!!!!!
----- Original Message -----
From: Rafael Costa dos Santos <rafael@thinkfreak.com.br>
Date: Friday, October 3, 2003 6:57 am
Subject: Re: C++ class inheritance
> Ok, but as I am C ANSI programmer it is a bit dificult to underestand.
>
> Are you saying that "RasPDU" is a general class that depends on the
> template
> (in this case "H225_RegistrationRequest") that is informed ?
>
> Is it similar to create a specific class like:
>
> class RasPDU : public H225_RegistrationRequest
> {
> } ;
>
> and inherit from it ?
>
> class RegistrationRequestPDU : public RasPDU
> {
> } ;
>
> On Thursday 02 October 2003 07:30, Voicu Liviu wrote:
> > Rafael Costa dos Santos wrote:
> > >Can anyone explain me what does < > means ?
> > >Example:
> > >
> > >class RegistrationRequestPDU : public
> RasPDU<H225_RegistrationRequest>> >{
> > >} ;
> > >
> > >Is "RegistrationRequestPDU" inheriting from RasPDU,
> > > H225_RegistrationRequest or both ?
> >
> > RegistrationRequestPDU inherits from RasPDU using template
> > H225_RegistrationRequest ?
>
> --
> Rafael Costa dos Santos
> rafael@thinkfreak.com.br
> -
> To unsubscribe from this list: send the line "unsubscribe linux-c-
> programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2003-10-03 21:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-02 4:00 C++ class inheritance Rafael Costa dos Santos
2003-10-02 7:30 ` Voicu Liviu
2003-10-03 12:57 ` Rafael Costa dos Santos
2003-10-03 16:19 ` Darío Mariani
-- strict thread matches above, loose matches on Subject: below --
2003-10-02 12:27 Sandro Dangui
2003-10-03 21:18 IVAN DE JESUS DERAS TABORA
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).