make a default constructor having other class member objects

class Date
Date(int=1, int=1, int=1990);

class Person
Person(string="", string="", Date=NULL);

class RealEstateAgent:Public Person
RealEstateAgent(string="",string="",Date=NULL,Date=NULL,int=NULL, double=0.0);

class Customer:Public Person
Customer(string="",string="",Date=NULL,string="", double=0.0);


My problem is below (property class constructor) , how can I assign default values with Customer object and RealEstateAgent?

Class Property
1
2
 
Property(string, Customer,RealEstateAgent, Date);





Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
class Date
{
public:
    Date(int=1, int=1, int=1990) {}
};

class foo
{
public:
    //Using C++11
    foo(Date d = {}) {}
    //Using older C++
    foo(Date d = Date()) {}
};
No, my problem is for the property class.

Property(string="", Customer,RealEstateAgent, Date=NULL);

I do not know how to initialize default arguments for parameter 2 and parameter 3.
Exactly the same way:
1
2
3
4
//Using C++11
Property(string="", Customer= {} ,RealEstateAgent = {}, Date=NULL);
//Using older C++
Property(string="", Customer = Customer(), RealEstateAgent= RealEstateAgent(), Date=NULL);
Yes, got it. thank you!!!
Topic archived. No new replies allowed.