ΓΛΩΣΣΑ C++ - ΜΑΘΗΜΑ 3 - ΚΛΑΣΕΙΣ ΚΑΙ ΔΕΙΚΤΕΣ (4δ)Dimitris Psounis
ΠΕΡΙΕΧΟΜΕΝΑ ΜΑΘΗΜΑΤΟΣ
Α. Θεωρία
1.Διαχείριση Μνήμης
1.1.Στατική Δέσμευση Μνήμης
1.2.Στατική Δέσμευση Μνήμης για Συνήθεις Μεταβλητές
1.3.Στατική Δέσμευση Μνήμης για Αντικείμενα
2.Δυναμική Δέσμευση Μνήμης
2.1.Δείκτες (Υπενθύμιση από C)
2.2.Οι τελεστές new και delete
2.3.Δυναμική Δέσμευση για Συνήθεις Μεταβλητές
2.4.Δυναμική Δέσμευση για Αντικείμενα
2.5.Δυναμική Δέσμευση και Κατασκευαστές
3.Κλάσεις που περιέχουν δείκτες
3.1.Παράδειγμα κλάσης που περιέχει δείκτες
3.2.…και ένα πρόβλημα (χωρίς λύση για την ώρα)
4..Δυναμική Δέσμευση Μνήμης για Πίνακες
4.1.Μονοδιάστατοι πίνακες
4.2.Παράδειγμα δέσμευσης μνήμης για μονοδιάστατους πίνακες
4.3.Διδιάστατοι πίνακες
4.4.Παράδειγμα δέσμευσης μνήμης για διδιάστατους πίνακες
B. Ασκήσεις
Η ΓΛΩΣΣΑ C++ - ΜΑΘΗΜΑ 2 - ΕΙΣΑΓΩΓΗ ΣΤΙΣ ΚΛΑΣΕΙΣ (4 διαφ)Dimitris Psounis
Α. Θεωρία
1. Κλάσεις
1.1 Γενικά
1.2 Ορισμός Κλάσης
1.3 Δημόσια (public) στοιχεία της κλάσης
1.4 Ιδιωτικά (private) στοιχεία της κλάσης
1.5 Παράδειγμα (προδιαγραφές)
2 Περισσότερα για τις κλάσεις
2.1 Ορισμός Συναρτήσεων έξω από την Κλάση
2.2 Παρουσίαση Ιδιωτικών – Δημόσιων Μέλων μιας κλάσης
2.3 Χωρισμός σε Αρχεία
3. Ειδικές Μεθόδοι Κλάσεων
3.1 Γενικά
3.2 Κατασκευαστής (constructor)
3.3 Καταστροφέας (destructor)
3.4 Ελεγκτές Πρόσβασης (accessors)
B. Ασκήσεις
ΓΛΩΣΣΑ C++ - ΜΑΘΗΜΑ 3 - ΚΛΑΣΕΙΣ ΚΑΙ ΔΕΙΚΤΕΣ (4δ)Dimitris Psounis
ΠΕΡΙΕΧΟΜΕΝΑ ΜΑΘΗΜΑΤΟΣ
Α. Θεωρία
1.Διαχείριση Μνήμης
1.1.Στατική Δέσμευση Μνήμης
1.2.Στατική Δέσμευση Μνήμης για Συνήθεις Μεταβλητές
1.3.Στατική Δέσμευση Μνήμης για Αντικείμενα
2.Δυναμική Δέσμευση Μνήμης
2.1.Δείκτες (Υπενθύμιση από C)
2.2.Οι τελεστές new και delete
2.3.Δυναμική Δέσμευση για Συνήθεις Μεταβλητές
2.4.Δυναμική Δέσμευση για Αντικείμενα
2.5.Δυναμική Δέσμευση και Κατασκευαστές
3.Κλάσεις που περιέχουν δείκτες
3.1.Παράδειγμα κλάσης που περιέχει δείκτες
3.2.…και ένα πρόβλημα (χωρίς λύση για την ώρα)
4..Δυναμική Δέσμευση Μνήμης για Πίνακες
4.1.Μονοδιάστατοι πίνακες
4.2.Παράδειγμα δέσμευσης μνήμης για μονοδιάστατους πίνακες
4.3.Διδιάστατοι πίνακες
4.4.Παράδειγμα δέσμευσης μνήμης για διδιάστατους πίνακες
B. Ασκήσεις
Η ΓΛΩΣΣΑ C++ - ΜΑΘΗΜΑ 2 - ΕΙΣΑΓΩΓΗ ΣΤΙΣ ΚΛΑΣΕΙΣ (4 διαφ)Dimitris Psounis
Α. Θεωρία
1. Κλάσεις
1.1 Γενικά
1.2 Ορισμός Κλάσης
1.3 Δημόσια (public) στοιχεία της κλάσης
1.4 Ιδιωτικά (private) στοιχεία της κλάσης
1.5 Παράδειγμα (προδιαγραφές)
2 Περισσότερα για τις κλάσεις
2.1 Ορισμός Συναρτήσεων έξω από την Κλάση
2.2 Παρουσίαση Ιδιωτικών – Δημόσιων Μέλων μιας κλάσης
2.3 Χωρισμός σε Αρχεία
3. Ειδικές Μεθόδοι Κλάσεων
3.1 Γενικά
3.2 Κατασκευαστής (constructor)
3.3 Καταστροφέας (destructor)
3.4 Ελεγκτές Πρόσβασης (accessors)
B. Ασκήσεις
This document celebrates the installation of Tom Irby as pastor. It mentions climbing a mountain in the Himalayas and includes the titles and performers of two songs - "Falling" and "Go Outside" - both written by Seth Irby and performed by Seth and Laura Irby.
Autism affects approximately 1 in 166 people and is more common in boys, affecting 1 in 70. It is a developmental brain disorder characterized by difficulties with social interaction and communication. While the exact causes are unknown, autism is believed to involve both genetic and environmental factors. There is no cure for autism, but early treatment including therapy can help those affected overcome challenges and learn skills like communication, which is key to improving outcomes.
The ancient Olympic Games began in Greece over 2,800 years ago and were religious festivals held every four years to honor Zeus. The modern Olympic Games were revived in 1896 in Athens and have since grown into a global event held every two years, alternating between Summer and Winter Games. London will host the 2012 Summer Olympics, becoming the first city to host the Olympics three times.
This document celebrates the installation of Tom Irby as pastor. It mentions climbing a mountain in the Himalayas and includes the titles and performers of two songs - "Falling" and "Go Outside" - both written by Seth Irby and performed by Seth and Laura Irby.
Autism affects approximately 1 in 166 people and is more common in boys, affecting 1 in 70. It is a developmental brain disorder characterized by difficulties with social interaction and communication. While the exact causes are unknown, autism is believed to involve both genetic and environmental factors. There is no cure for autism, but early treatment including therapy can help those affected overcome challenges and learn skills like communication, which is key to improving outcomes.
The ancient Olympic Games began in Greece over 2,800 years ago and were religious festivals held every four years to honor Zeus. The modern Olympic Games were revived in 1896 in Athens and have since grown into a global event held every two years, alternating between Summer and Winter Games. London will host the 2012 Summer Olympics, becoming the first city to host the Olympics three times.
El documento presenta resúmenes breves sobre diversas atracciones turísticas en varios estados de Estados Unidos, incluyendo la Estatua de la Libertad y Grand Central Station en Nueva York, el Centennial Olympic Park en Georgia, el Castillo de San Marcos en Florida, las Cascadas Havasu en Arizona, Graceland en Tennessee, los géiseres en Yellowstone en Wyoming, el Gran Cañón del Colorado, y Hearst Castle y Rodeo Drive en California. Cubre una amplia variedad de lugares históricos, naturales y culturales populares para visitar a través del país
The document provides background research on the concept of "Secret Lure" which explores themes of concealment and exposure through interactive installation art. It discusses how interaction with hidden spaces can reveal secrets of the self and influence perceptions of private versus public. The proposed installation would use inputs like touching or looking through openings to produce video or audio outputs related to themes of self-reflection, childhood memories, and consumerism. References on related artworks and philosophical concepts are also included.
Australia is an island continent located between the Indian and Pacific oceans. Its capital is Canberra, and some key facts are:
- Total population is around 20 million people
- The native Australians are the Aboriginal people
- Major cities include Sydney, Melbourne, and Brisbane
- Famous sights include the Great Barrier Reef and Uluru
- The Queen of England is the head of state, represented by the Governor-General
- Iconic Australian animals are kangaroos and emus
El documento habla sobre los cambios en las relaciones afectivas en la era moderna. Ahora se busca una relación basada en la individualidad, el respeto y el deseo en lugar de la dependencia. El amor romántico de encontrar la otra mitad para sentirse completo está desapareciendo. Con el avance tecnológico, las personas están perdiendo el miedo a estar solas y aprendiendo a estar bien consigo mismas. Las buenas relaciones afectivas son entre personas enteras que no dependen del otro y ambos crecen.
This document contains announcements and reminders for students regarding various school activities, events, and deadlines. It includes information about senior calendar dates, soccer games, fundraisers, scholarships, volunteer opportunities, and more. The document provides updates on extracurricular activities as well as important academic deadlines for seniors.
Culinary arts students are selling tickets to a dinner theater fundraiser featuring a 5 course meal and Broadway scenes. Tickets are $15 and available from culinary arts students or room B230.
Team Clemens is holding a spaghetti fundraiser for Relay for Life on April 18th. Tickets are $5 and include spaghetti, meatballs, bread, and dessert.
The Clemens track team had several athletes qualify for regionals.
The document summarizes several winter festivals and events taking place in Romania between November and December 2008. It describes the name, date, location and highlights of each event, which celebrate Romanian folk traditions, customs, music, dance, and the start of the winter holiday season. Events include a Christmas fair in Bucharest featuring artisan goods, caroling festivals, celebrations of winter traditions and customs in different towns and villages, and festivals marking religious observances like St. Nicholas Day and the Archangels Michael and Gabriel.
El documento discute los cambios en las relaciones afectivas en la era moderna. Se enfatiza la importancia de la individualidad y de no depender del otro para la felicidad. Las relaciones ahora buscan la compatibilidad, el respeto y el deseo de estar juntos en lugar de la dependencia. La soledad ya no es vista con vergüenza sino que da dignidad y permite descubrir la fuerza personal. Las mejores relaciones son entre personas enteras que se respetan mutuamente.
The document discusses three scenarios faced by pilgrim colonies and their proposed solutions. The first colony proposes fishing to find food. The second suggests accessing water to keep pilgrims healthy. The third recommends using sticks to throw at hostile Indians for protection.
This document lists various drawing materials and techniques used in an artist's work including charcoal study, graphite on mylar, graphite, charcoal and gesso on brown paper, pen and ink, and color pencil.
The Mayans were a dominant indigenous civilization in Mesoamerica from 1800 BC to AD 250 that excelled in agriculture, writing, calendar making, and mathematics. They built large urban centers like Tikal with temples, palaces, and ball courts of religious and political significance. The Mayans developed an advanced hieroglyphic writing system and the only fully developed calendar in the ancient Americas using the concept of zero. While their civilization declined after AD 250, elements of Mayan culture still survive today.
El documento habla sobre los cambios en las relaciones afectivas en la era moderna. Ahora se busca una relación basada en la individualidad, el respeto y el deseo en lugar de la dependencia. El amor romántico de encontrar la otra mitad para sentirse completo está desapareciendo. En cambio, la nueva forma de amor apunta a la unión de dos personas enteras que se respetan mutuamente y no necesitan al otro para ser felices.
This document summarizes information about lung transplantation. It discusses that lungs are located in the chest and function to oxygenate blood and remove carbon dioxide. Over 1,200 lung transplants are performed annually in the US, with a 5-year survival rate of 72-83%. However, over 111,000 people are waiting for lungs and over 6,500 people die each year waiting. Lung transplants are considered for those with end-stage lung disease who have less than 2 years to live. The procedure takes 4-8 hours in specialized hospitals and has a high cost, but can extend life for transplant recipients who must follow medical therapies and lifestyle restrictions long-term.
The heart is located in the center-left portion of the chest and pumps oxygen-rich blood to all cells in the body. The United States performs over 2,000 heart transplants annually, with survival rates of 81% after 1 year and around 68% after 5 years. Heart transplants may be required for severe heart failure or defects that cannot be treated otherwise. Recipients must meet health criteria and take anti-rejection drugs lifelong, while living with cardiac monitoring and dietary restrictions after transplant.
The cornea is the transparent front part of the eye that transmits and focuses light. About 40,000 cornea transplants are performed in the US each year, with a 90% success rate. Candidates are screened for infections or health risks and may be disqualified for certain conditions. The transplant procedure takes 1-2 hours and costs around $7,500. Post-surgery therapy includes eye drops, pills, and activity restrictions for healing.
Asthma is a chronic inflammation of the airways that affects millions of adults and children in the U.S. It is caused by triggers like dust, pollen, pet hair, or tobacco smoke that bring about symptoms like wheezing, shortness of breath, and coughing. While asthma cannot be passed between individuals, chronic coughing may impact transmission of other illnesses. The disease affects the bronchial tubes leading to the lungs and symptoms are often worse in the morning or evening in response to cold air. Preventative inhalers can help control symptoms and attacks to manage the disease, which is lifelong once developed, though its effects can be minimized with proper treatment.
Rabies is caused by a virus transmitted through the saliva or nervous system tissue of an infected animal. It causes flu-like symptoms that can develop into cerebral dysfunctions, anxiety, and delirium. Over 50,000 people in Asia and Africa die from rabies each year. While rabies can be either acute or chronic depending on treatment, prevention focuses on vaccinating pets, removing strays, and avoiding contact with wild animals.
Narcolepsy is a neurological disorder that affects sleep control, making it difficult to stay awake during the day. Its causes are unknown but believed to be genetic and related to low levels of the brain chemical hypocretin. Symptoms include extreme daytime sleepiness with focus problems, loss of muscle tone during wakefulness, and vivid dreams or hallucinations when waking or falling asleep, typically affecting people ages 15-25 or those who don't sleep well at night.
Sickle cell anemia is a genetic blood disorder caused when both parents carry the sickle cell trait and pass it to their child. The red blood cells take on a sickle shape, which prevents them from properly carrying oxygen throughout the body. Symptoms may appear after four months of age and include attacks of pain, breathing issues, fatigue and more. While there is no cure, new treatments are helping those with sickle cell anemia live longer, into their 50s rather than the previous average of 20-40 years of age. Prevention includes vaccinations, genetic counseling before having children, and living a normal life with proper precautions.
Leprosy is caused by the bacteria Mycobacterium leprae, which is usually spread through respiratory droplets. Children are more susceptible than adults. The top three countries with the most reported leprosy cases are India, Brazil, and Burma. Leprosy has an average incubation period of 3-5 years and the primary sign is pale skin lesions with reduced sensation. If diagnosed early, nerve damage and disability can be avoided through treatment with antibiotics such as rifampicin and daspone.
HIV and AIDS can be transmitted sexually or through blood and from pregnant women to their babies. While anyone can contract HIV, those most at risk are drug users and the sexually active. Since 1977, HIV/AIDS has been a major problem in Africa due to a lack of money for medicine and treatment.
Osteogenesis imperfecta is a genetic disorder caused by a defect in the collagen gene that results in brittle bones that break easily from minor stress or trauma. There are four main types of OI that vary in severity from very mild to lethal in infancy. While there is no cure for OI, treatments focus on increasing bone strength through bisphosphonates and low-impact exercise, as well as surgery to repair broken bones. People with OI must manage their condition for life through precautions to avoid further fractures.
Lupus is an autoimmune disease with no known cause that predominantly affects women aged 15-44, especially those of African American, Asian, Native American, or Pacific Islander descent. Common symptoms include arthritis, joint pain, fever, fatigue, skin rash, and sensitivity to sunlight. While the signs and symptoms vary per individual, lupus produces antibodies that attack the body's own tissues and can affect the lungs, blood, brain, kidney, heart, and joints. There is no cure for lupus currently, but treatment involves medications like steroids, immunosuppressants, and anti-inflammatories to reduce symptoms, though it can sometimes be fatal depending on the severity of the case.
Yellow fever is caused by a virus transmitted through the bites of infected female mosquitoes, with an incubation period of 3-6 days. Symptoms include headache, fever and muscle aches initially, and potentially progressing to jaundice, liver failure, and black vomit. While most cases are mild, the disease can be fatal for around 3% of infected individuals in the second more severe phase if left untreated.
Bulimia nervosa is an eating disorder characterized by binge eating followed by purging. It can be caused by genetic and environmental factors like role models and social pressures. While anyone can develop it, girls aged 15-24 are most at risk. Bulimia damages the entire body and can lead to organ failure or death if left untreated. Treatment focuses on breaking the binge-purge cycle through therapy and support to address underlying emotional issues.
Yellow fever is caused by a virus transmitted through the bites of infected female mosquitoes, with an incubation period of 3-6 days. Symptoms include headache, fever, and muscle aches initially, which can develop into more severe symptoms like jaundice, liver failure, and black vomit in the second phase for some patients. While most cases resolve on their own, around 3% of infected individuals may die from yellow fever if the disease progresses to liver and kidney failure.
Osteogenesis imperfecta is a genetic disorder caused by a defect in the collagen gene that results in brittle bones that break easily from minor stress or trauma. There are four main types of OI that vary in severity from very mild to lethal in infancy. While there is no cure for OI, treatments focus on increasing bone strength through bisphosphonates and low-impact exercise, as well as surgery to repair broken bones. People with OI must manage their condition for life through precautions to avoid further fractures.
Bubonic plague is caused by the Yersinia pestis bacterium which is typically transmitted through the bites of infected fleas living on rodents like rats, squirrels, and prairie dogs. Symptoms include fever, chills, swollen lymph nodes, and other flu-like symptoms appearing 1-6 days after exposure. While not usually chronic, one can be reinfected, so prevention focuses on controlling rodent populations to limit flea-borne transmission of the plague bacterium.
African trypanosomiasis, also known as sleeping sickness, is caused by a parasite called Trypanosoma and transmitted by the bite of the tsetse fly. It affects people in rural parts of Africa and causes symptoms like swelling at the bite site, severe fatigue, headaches, joint pain, behavioral changes, and disturbed sleep patterns. While it can cause neurological disorders and death if left untreated, it can be prevented by avoiding tsetse fly habitats or wearing protective clothing, and treated with drugs like Pentamidine, Suramin, and combinations of other drugs.
Varicella-zoster virus causes both chickenpox and shingles. Shingles occurs when the virus reactivates after dormancy in the nervous system following chickenpox. It is characterized by a painful rash that typically affects a limited area on one side of the body. Treatment aims to reduce pain and complications through antiviral medication started within 24 hours of symptom onset, along with anti-inflammatory drugs and soothing baths. While shingles itself is usually not fatal, high-risk groups could die if exposed without proper medical care.
Anthrax is caused by the bacteria Bacillus anthracis. It can infect humans through contact with infected animals or animal products, as well as through inhalation of anthrax spores. There are three main types - cutaneous (skin), inhalation (lungs), and gastrointestinal (digestive system). Symptoms vary depending on type but can include lesions, vomiting, diarrhea, and respiratory issues. Anthrax spores can also be used as a biological weapon. Diagnosis involves cultures and antibody tests while treatment requires long courses of antibiotics.
Lupus is an autoimmune disease with no known cause that predominantly affects women aged 15-44, especially those of African American, Asian, Native American, or Pacific Islander descent. Common symptoms include arthritis, joint pain, fever, fatigue, skin rash, and sensitivity to sunlight. While there is no cure for lupus since it is a chronic condition that produces antibodies against a person's own tissues, treatment focuses on managing symptoms with medications like steroids, immunosuppressants, and anti-inflammatories.