WEEK 1-Project 2 ()

Source: Internet
Author: User

Print? /*
* Copyright and version Declaration of the program
* Copyright (c) 2013, a student from the computer College of Yantai University
* All rightsreserved.
* File name: object. cpp
* Author: Yang shaoning
* Completion date: January 1, April 9, 2013
* Version: v1.0
* Input Description: None
* Problem description :.
* Program output :.
*/
# Include <iostream>
Using namespace std;
Class {
Private:
Int;
Public:
A () {a = 0 ;}
A (int aa): a (aa) {}// defines the constructor and initializes data member a with the aa parameter.
Int get () {return ;}
};
Int main (){
A * p; // defines the pointer object p of Class.
P = new A (6); // use p to point to A dynamic object and initialize it as an integer.
Cout <p-> get () <endl;
Return 0;
}

/*
* Copyright and version Declaration of the program
* Copyright (c) 2013, a student from the computer College of Yantai University
* All rightsreserved.
* File name: object. cpp
* Author: Yang shaoning
* Completion date: January 1, April 9, 2013
* Version: v1.0
* Input Description: None
* Problem description :.
* Program output :.
*/
# Include <iostream>
Using namespace std;
Class {
Private:
Int;
Public:
A () {a = 0 ;}
A (int aa): a (aa) {}// defines the constructor and initializes data member a with the aa parameter.
Int get () {return ;}
};
Int main (){
A * p; // defines the pointer object p of Class.
P = new A (6); // use p to point to A dynamic object and initialize it as an integer.
Cout <p-> get () <endl;
Return 0;
}
Result:

 

Feelings: Dynamic Object Creation

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.