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

QuantLib or more general C++

Hi there,

If anyone has experience with quantlib, how do I initialize a Bond
Class??
If not, here is a more generalized C++ question :)
I have a initialized an object with the constructor, which is protected
on the Bond class, and when I try to compile a line initializing a
object of the Bond Class, it complains that it is protected.
Can anyone help me out??

Thanks,
Louis

Apr 5 '06 #1
4 1355

lo************@gmail.com wrote:
Hi there,

If anyone has experience with quantlib, how do I initialize a Bond
Class??
If not, here is a more generalized C++ question :)
I have a initialized an object with the constructor, which is protected
on the Bond class, and when I try to compile a line initializing a
object of the Bond Class, it complains that it is protected.
Can anyone help me out??


Only classes derived from Bond can instantiate Bond objects using a
protected constructor. If the Bond class has another constructor that
is public, you can instantiate a Bond object using that constructor.
Otherwise the only thing you can do is instantiate an object of a type
derived from Bond.

Gavin Deane

Apr 5 '06 #2
Thanks for the swift answer :)

If it woudn't be to much of a burden, could you provide a small
example?? :)

Thanks

Apr 5 '06 #3
lo************@gmail.com wrote:
Thanks for the swift answer :)

If it woudn't be to much of a burden, could you provide a small
example?? :)


class Bond {
protected:
Bond() : i_(0) {}
Bond(int i) : i_(i) {}
private:
int i_;
};

class Derived : public Bond {
public:
Derived() : Bond() {}
Derived(int i) : Bond(i) {}
};
int main() {
//Bond b1; // protected constructor
//Bond b2(5); // protected constructor
Derived d1;
Derived d2(5);
}
Ben Pope
--
I'm not just a number. To many, I'm known as a string...
Apr 5 '06 #4
Thanks!!! :) it actually worked... my C++ skills aren´t that good...

Apr 5 '06 #5

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

Similar topics

303
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
22
by: bearophile | last post by:
Ville Vainio: >It's highly typical for the newbies to suggest improvements to the >language. They will usually learn that they are wrong, but the >discussion that ensues can be fruitfull anyway...
11
by: Adonis | last post by:
What I do not understand, or not clear to me I should say, is how can some people regard Python as a scripting language? In particular the JAVA crowd. Unless my understanding is off, and from what...
11
by: Jonan | last post by:
Hello, For several reasons I want to replace the built-in memory management with some custom built. The mem management itlsef is not subject to my question - it's ok to the point that I have...
39
by: Antoon Pardon | last post by:
I was wondering how people would feel if the cmp function and the __cmp__ method would be a bit more generalised. The problem now is that the cmp protocol has no way to indicate two objects are...
18
by: Reece Hart | last post by:
More praise for 7.4RC2: I've installed 7.4RC2 and restored a fairly complex 20GB database (from 7.3.4) with ~75M rows in 30 tables and 4 schemas, numerous triggers and constraints, procs in...
13
by: Jeff Davis | last post by:
Right now performance isn't a problem, but this question has me curious: Let's say I have a shopping cart system where there is a "products" table that contains all possible products, and an...
7
by: Barry | last post by:
Hi All, I am a newcommer to Postgresql, currently I am looking at moving a Pick based application across to PostgreSQL. I am using RH Linux and Postgresql 7.3.6 The test system I am using...
2
by: SpotNet | last post by:
Scott M. Have your experiences shown you that programmers may give the best computer advice, analysis, and solutions even at the worst of times, for a PC user? ;~D Haven't crossed many Network...
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: 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...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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...

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.