Search
 
SCRIPT & CODE EXAMPLE
 

CPP

constructor init list

class Parent
{
	//public member or methods can be seen and accessed by any other object
public:
    Parent(int publik, int protect, int privat)	
    :   mPublik(publik),	//with the colon starts the initializing list
        mProtect(protect),	//it sets the member of the object being created
        mPrivat(privat)		//used as if the member were 'methods'
        					//it has to be between a constructors head and body
    {
        //nothing to do here if you just want to set your members
    }

    int mPublik;
    
	//protected member or methods of a class will be seen in child objects but 
	//not objects of other classes
	//this is something in between private and public
protected:
    int mProtect;
	//private member or methods wont be seen by child members or objects of 
	//other classes
private:
    int mPrivat;
};
Comment

PREVIOUS NEXT
Code Example
Cpp :: button creation in C++ GUI 
Cpp :: arrays to function c++ 
Cpp :: Normal Initialisation of 3D Vector 
Cpp :: c++ switch integer 
Cpp :: windows install cppcheck 
Cpp :: tempcoderunnerfile.cpp:1:1: error: does not name a type 
Cpp :: log like printf c++ 
Cpp :: check if string in vector c++ 
Cpp :: Swift if...else Statement 
Cpp :: cast c++ 
Cpp :: icon on win32 button 
Cpp :: typeid to string c++ 
Cpp :: online convert c++ code to assembly language 
Cpp :: c++ compile to msi 
Cpp :: online computer graphics compiler c++ 
Cpp :: c++ get last element in array 
Cpp :: c++ & operator 
Cpp :: function prototype c++ 
Cpp :: array list cpp 
Cpp :: swap first and last character of string in c++ 
Cpp :: set elements to 42 back 
Cpp :: c++ excel cell blank cells 
C :: how to store a user input with spaces in c 
C :: read files in c 
C :: printf with bool 
C :: Creating a process in C 
C :: postgres random select 
C :: remove first character from string c 
C :: hi servicenow 
C :: typedef pointer 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =