473,396 Members | 1,914 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.

who called these functions?

I want to know who called these functions:
the constructor
the copy constructor

the question from this code:

class A
{
void func();
};

class B
{
friend class A:
private:
B();
};

void A::func()
{
B();
}

different compiler make different result.
who can explain?

Thx vary much.

Apr 17 '07 #1
1 1139
On Apr 17, 1:11 am, holmescn <holmesco...@gmail.comwrote:
I want to know who called these functions:
the constructor
the copy constructor

the question from this code:

class A
{
void func();
This member function is private
>
};

class B
{
friend class A:
The above colon is a syntax error
private:
B();
This ctor is declared but not defined anywhere
>
};

void A::func()
{
B();

}

different compiler make different result.
who can explain?

Thx vary much.
Try something that compiles, then ask your question...

#include <iostream>

class A
{
public:
void func();
};

class B
{
friend class A;
private:
B() { std::cout << "B()\n"; }
};

void A::func()
{
B b;
}

int main()
{
A a;
a.func();
}

/*
B()
*/

Apr 17 '07 #2

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

Similar topics

11
by: Douglas Peterson | last post by:
I have a simple class that verifies some data between the beginning and the end of a function: class Verify { Verify() { note the data value } ~Verify() { check if data value is the same as we...
6
by: Squeamz | last post by:
Hello, Say I create a class ("Child") that inherits from another class ("Parent"). Parent's destructor is not virtual. Is there a way I can prevent Parent's destructor from being called when a...
4
by: Ahmed S. Badran | last post by:
Hi, Is there a tool that would parse a C file and tell me the list of functions that are being called in the file. The C file includes header files for the functions being used. Also is there...
3
by: Lowell Kirsh | last post by:
I am integrating an open source library into a project which I will have to modify slightly. Before I modify it, I'd like to know which functions in the library are being called. Even though my...
2
by: Frank Lopez | last post by:
Question: Is there any way to use the Visual Studio .NET environment to easily identify C and C++ functions that are not called? If not, does anyone have any recommendations on some other...
7
by: Roberto Perez via .NET 247 | last post by:
Hello all and thank you in advance. We have several old applications in Cobol, Centura, etc that needs to be converted to .NET In order to save time our plan is to create web services and call...
6
by: Saurabh | last post by:
Hi All, I want to know something. Apart from Constructor and Destructor are there any other functions which get called automatically without user calling them? If yes,please tell me which are...
37
by: jht5945 | last post by:
For example I wrote a function: function Func() { // do something } we can call it like: var obj = new Func(); // call it as a constructor or var result = Func(); // call it as...
6
by: RandomElle | last post by:
Hi there I'm hoping someone can help me out with the use of the Eval function. I am using Access2003 under WinXP Pro. I can successfully use the Eval function and get it to call any function with...
6
by: chang | last post by:
Hi ALL, I am working in C from past few months. Still now i can't figure out who is called main() in 'C' programme? Main() is a function from that we can call our sunroutines but someone has to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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.