473,396 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Implicitly declared/defined member functions and inheritance

The following shortened table comes from a big company's C++ technical
document accompanied with its C++ compiler. This company's C++ compiler
was/is very popular in Windows platform programming. But I'm not sure
whether this table is accurate.

The language standard says "Operator functions are inherited", I guess
that it means all operator functions are inherited. But that table says
operator = is not. Is operator = an exception?

Could you please give me a another correct list to explain:

1. which member functions can be declared and/or defined implicitly?

2. which member functions can't be inherited in derived class?
Thank you.

-- Quotation 1 ---------------------------------------

--------------- inheritable ? -- provided implicitly ?

------------------------------------------------------

constructor -------- no ---------------- yes ---------

copy constructor --- no ---------------- yes ---------

destructor --------- no ---------------- yes ---------

operator = --------- no ---------------- yes ---------

-- Quotation 1 ends ----------------------------------

-- Quotation 2: ISO/IEC 14882 ---------------

13.5 Overloaded operators

6 ...The meaning of the operator = , (unary) &, and , (comma),
predefined for each type, can be changed for specific class and
enumeration types by defining operator functions that implement these
operators. Operator functions are inherited in the same manner as other
base class functions.
....
-- Quotation 2 ends -------------------------

Jul 23 '05 #1
7 5088
lovecreatesbeauty wrote:
The following shortened table comes from a big company's C++ technical
document accompanied with its C++ compiler. This company's C++ compiler
was/is very popular in Windows platform programming. But I'm not sure
whether this table is accurate.

The language standard says "Operator functions are inherited", I guess
that it means all operator functions are inherited. But that table says
operator = is not. Is operator = an exception?

Are you talking about C++/CLI and .NET 2? In .NET the base Object class has its operator=
disabled (private). If you define it as public in one of your classes, then all of your
derived classes of it, will also have operator=. C#/CLI on the other hand, "magically"
comes with an implicit operator= for user-defined classes, C++ however preserves this
semantics.
--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 23 '05 #2
On Mon, 09 May 2005 10:35:11 +0300, Ioannis Vranos
<iv*@remove.this.grad.com> wrote in comp.lang.c++:
lovecreatesbeauty wrote:
The following shortened table comes from a big company's C++ technical
document accompanied with its C++ compiler. This company's C++ compiler
was/is very popular in Windows platform programming. But I'm not sure
whether this table is accurate.

The language standard says "Operator functions are inherited", I guess
that it means all operator functions are inherited. But that table says
operator = is not. Is operator = an exception?

Are you talking about C++/CLI and .NET 2?


If he is, he is off-topic here, just as your reply is.

Kindly keep your ramblings about yet another non-standard extension
out of this group.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Jul 23 '05 #3
Jack Klein wrote:
If he is, he is off-topic here, just as your reply is.

Kindly keep your ramblings about yet another non-standard extension
out of this group.

Actually it is a standardised *extension* to C++2003. :-) Not part of ISO C++ though,
however some features of C++/CLI *will* become part of the core C++0x in the future, and
also it describes how C++ can interact with a VM.

Also the parts of it does not include any Forms, TextBoxes, etc that you may be afraid of,
any API usage is considered system-specific there too, the additional facilities provided
are minimal (actually apart from the Console class and String type I can't remember
something more).
Of course, the majority of the regulars will decide what will be topical here in the
future, however there can't be another newsgroup for C++/CLI, because it is ISO C++
extensions and can not "live" without ISO C++.

--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 23 '05 #4
Vranos, you can post another thread to talk about what you'er talking
about.

I want to know, in C++ (ISO/IEC 14882:1998):

1. For a class, which member functions can be declared/defined
implicitly.

2. Which base class members can't be inherited in derived class.

Jul 23 '05 #5
------- quotation: ISO/IEC 14882 -------

10.3 Virtual functions

4. Even though destructors are not inherited, a destructor in a
derived overrides a base class destructor declared virtual;
....
12.3.2 Conversion functions

5. Conversion functions are inherited.
13.5 Overloaded operators

6. ...The meaning of the operator = , (unary) &, and , (comma),
predefined for each type, can be changed for specific class and
enumeration types by defining operator functions that implement these
operators. Operator functions are inherited in the same manner as other
base class functions.

------- quotation ends -------

I've be taught that constructors, destructor and copy assignment are
not inherited from base classes in derived classes. As for these
members, derived classes will always have its own members instead of
inherit them from father classes.

But I don't find a complete list of these members from the language
standard.

Thank you.

Jul 23 '05 #6
lovecreatesbeauty wrote:
Vranos, you can post another thread to talk about what you'er talking
about.

I want to know, in C++ (ISO/IEC 14882:1998):

1. For a class, which member functions can be declared/defined
implicitly.

When you create a class SomeClass, an assignment operator and a copy constructor are
created implicitly which provide shallow copying (all data members are copied value-wise),
also a "default" constructor doing nothing ( SomeClass() ) and a "default" destructor
doing nothing.

2. Which base class members can't be inherited in derived class.

Everything is inherited (and can be disabled). Perhaps you may clarify what you mean with
"inherited".

--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 23 '05 #7
I found that Bruce Eckel talked about this topic in his `thinking in
C++, 2nd` section 14.

regards

Jul 23 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Sat | last post by:
Hi, I have a simplified version of a problem that I am facing (hope I haven't oversimplified it). This code doesn't work now and I want to find how I can make it work. Can I call the derived...
9
by: Bob Rock | last post by:
Hello, I was wondering when should static constructors be defined or are they even required??? Also, when are they implicitly called??? Bob Rock
5
by: Guenther Sohler | last post by:
Hallo, I have written a very small testcase to try threads within classes My code is following: #include <stdio.h> #include <unistd.h> #include <pthread.h>
2
by: Thomas Matthews | last post by:
Hi, I have a hierarchy of classes and would like to create an array of pointers to member functions that could also contain pointers to the parent member functions as well. What is the syntax...
8
by: Gert Van den Eynde | last post by:
Hi all, I have a question on interface design: I have a set of objects that are interlinked in the real world: object of class A needs for example for the operator() an object of class B. On...
3
by: lovecreatesbeauty | last post by:
Predefined class member functions and inheritance How many member functions on earth can be provided (predefined) by standard-compliant compilers? Scott Meyers says that there are 6:...
7
by: bisforbenson | last post by:
I'm trying to compile things with gcc 4. After running the following command: % gcc -O3 -g -Wall -Wno-unused -DLINUX -D_REENTRANT -o ../../obj/egi.o -I../../include/ -I... -c egi.cpp i get...
3
by: Doug Eleveld | last post by:
Hi Everyone, I have been playing aroung with 'object-oriented' C for a while now and I have come up with an interesting way to simulate C++ inheritance and non-member functions in C in a 100%...
3
by: Paavo Helde | last post by:
C++ lets you declare functions in headers which are actually not defined in the source code. During a cleanup cycle for a library I would like to ensure that all free and member functions...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.