473,386 Members | 1,766 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,386 software developers and data experts.

implementation question

I had the following question on a C++ test and I don't think I got it
right and I was hoping someone could answer it. I am pretty new to C++.
Thanks.
The question was, given the following code :

class A {

private:
int a_;
static double db_;
public :
A();
};
class B: public A {
private:
int b_;
public:
B();
B(const B& src);
};
class C {
{
private:
B* pb_;
public:
C();
C(const C& );
const C& operator=(const C& src);
~C() {delete pb_; }
};
implement the classes A, B and C. I'm not even sure I understand the
question but I think they mean, write the specific code for the
constructors and write the code ( in main ) that would create specific
instances of A, B and C. Thank you very much to whoever would be kind
enough to do this.

Mark

Apr 10 '06 #1
2 1304

markpark wrote:
I had the following question on a C++ test and I don't think I got it
right and I was hoping someone could answer it. I am pretty new to C++.
Thanks.
And what on Earth made you think comp.lang.c, rather than comp.lang.c++
was the right place to ask.

Followups set...


The question was, given the following code :

class A {

private:
int a_;
static double db_;
public :
A();
};
class B: public A {
private:
int b_;
public:
B();
B(const B& src);
};
class C {
{
private:
B* pb_;
public:
C();
C(const C& );
const C& operator=(const C& src);
~C() {delete pb_; }
};
implement the classes A, B and C. I'm not even sure I understand the
question but I think they mean, write the specific code for the
constructors and write the code ( in main ) that would create specific
instances of A, B and C. Thank you very much to whoever would be kind
enough to do this.

Mark


Apr 10 '06 #2
markpark wrote:
I had the following question on a C++ test and I don't think I got it
right and I was hoping someone could answer it. I am pretty new to C++.


[snip]

Wrong group. This is comp.lang.c, we discuss C here, not that other
completely different language you are asking about, try comp.lang.c++.

Robert Gamble

Apr 10 '06 #3

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

Similar topics

2
by: Kapil Khosla | last post by:
Dear all, I am trying to underlying implementation of virtual functions in C++. The way I understand polymorphism is class Base { public: virtual int func(); };
3
by: Yves Dhondt | last post by:
Hello, I've got the following UML design : C | A _____|______ B So 2 objects A and B are connected through a relation C. (For example an employment scheme : person A1 worked for company...
6
by: Paul Fame | last post by:
Hello World, This is not a flame, but a question about the fundamentals of the language. Unlike some languages, C++ requires class member functions to be declared twice: once in the class...
9
by: Anon Email | last post by:
Hi people, I'm learning about header files in C++. The following is code from Bartosz Milewski: // Code const int maxStack = 16; class IStack
3
by: masood.iqbal | last post by:
In this day and age, you never say no to any work that is thrown at you ---- so when I was offered this short-term contract to convert legacy C code to C++, I did not say no. Personally I believed...
175
by: Ken Brady | last post by:
I'm on a team building some class libraries to be used by many other projects. Some members of our team insist that "All public methods should be virtual" just in case "anything needs to be...
10
by: Martin Zenkel | last post by:
Assumed two assemblies (one C# and one C++), C++ refers to C#. The follwing code compiles and works well under VS 2002! VS 2003 C++ compiler reports the error "error 2555:...
37
by: jortizclaver | last post by:
Hi, I'm about to develop a new framework for my corporative applications and my first decision point is what kind of strings to use: std::string or classical C char*. Performance in my system...
1
by: Varun Kacholia | last post by:
Hi, I have a question regarding SGI STL sort implementation: In case of equal elements, will they be output in the same order each time I sort? (I understand that it is not a stable sort, and by...
12
by: Slaunger | last post by:
Hi, I am new here and relatively new to Python, so be gentle: Is there a recommended generic implementation of __repr__ for objects equal by value to assure that eval(repr(x)) == x independet...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...

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.