--Puzzle-- Which is faster in a loop?
if( x != n ) x = n;
-or-
x = n;
--Answer--
![]() | You are viewing Log in Create a LiveJournal Account Learn more | Explore LJ: Life Entertainment Music Culture News & Politics Technology |
--Puzzle-- Which is faster in a loop?
if( x != n ) x = n;
-or-
x = n;
--Answer--
GDC 2009 – Josh Jones
There was as usual lots of good debating and discussion, and the workshops went very well. The IGDA is still gearing towards supporting local chapters and focusing on members, while handling international relations and forming new ventures such as the GGJ and the coders SIG. This was some of what I talked about at the last local chapter meeting (2nd Tuesday in May) where everyone shared GDC experiences and won raffle prizes.
Sessions
Advanced Graphics with DirectX (Tutorial)
This is a basic class but goes over all the ground work and is good for a refresher or starting out. This was an all-day course and they had everything from A to Z plus a couple other topics from other speakers at the end.
API in DX10 has been redone
-no fixed function
-no more legacy code
-non-kernel drivers (doesn't kill the OS)
-Vista = Memory Management is in the OS
Benchmark Mode
-check performance
-automated
-debugging
-easier for card makers
Constant Buffers
-HLSL, Vector, Color
-close together
-best kept as a smaller heap of buffers sorted by frequency of access
-bind about 5 and share them
Dynamic Buffer
-updates
-non GPU geometry (particles, translucency)
Early 2 Optimize
-no alpha test -> shader discard pixel
-have two shaders
1. write-z
2. full shader
Formats
-Texture - bigger, slower
-Render targets
Geometry Shader
-less is better
-DX11 introduces tessellation
High Batch Count
-instancing
Input Assembly
-DXOptimize
-Input compression
Juggling with states
-DX10 = immutable states
-states at load time
-dirty states
Klears
-use Z clear()
-only color if needed
Level of Detail
-still important
Multi GPU
-optimize for frame pipeline
-per GPU
No Way Jose!
-don't render skybox first (HUD last is ok)
-don't forget frustum culling
Output Streaming
-multi-pass GS (Geometry Shaders)
Parallelism
-CPU | GPU - check with PIX - STAGING > DEFAULT
Queries
-get results when available only
Resolving MSAA Buffers
-resolve !free
-avoid depth buffer
-MSAA Render Target -> Resolve Operation -> Non-MSAA Back Buffer
Shadow Mapping
-DST
-ATI: D16
-NVIDIA: D32_S8
-disable color
-depth-only is much faster
-no clip-discard
-cut aniso
-Gather() DX 10.1
Transparency
-ZPS, transparency & opacity
-clip/discard early
Updating Textures
-do not create and destroy textures at runtime
-create during load and use ring buffer
Verifying Performance
-use IHV tools
-ATI: GPU perfshader
-NVIDIA: NVPerfHUD
Writing Fast Shaders
-ALU: TEX HW ratio
-Parallel Branching Interpolation
Xtra Performance
-larger triangle with unused space is better than two triangles
-larger triangles in small complex areas instead of all small triangles
Your call to action
-Manage resources
-Balancing
-Texture Updates
-Parallel (Multi GPU)
-Instancing
Z-Buffer Access
-Bind Dynamic Buffer as texture
cem@nvidia.com
nicolas.thibieroz@amd.com
Rain
-scrolling texture, specialized shader
Sun rays
-raytrace march, single cascade shader
MSAA deferred rendering - in/out pixel freq
-lighting stages
-DX10.1 or less adds
G-Buffer optimizations
-Shader A2C when hi-rez/hi MSAA
-SV_POS 1-3 pit pattern
-x+y = coverage
-alpha -> alpha'
-zoom
Min-Max Shadow Map
-originally presented by Dmitriev at GDC07
DirectX 11
-SV_Coverage - bit mask - System Value
-available to shaders during stages
-double precision -slower but now available
-Gather(); - now has channel, offset (-32 - 31)
-ddx_coarse - potential derivatives - same for all pixels
-f32tof16 - f16 low 16 bits - for packing & compression - first bit high - reverse bits
-Unordered Access Views - main new feature in DX11
-Raw View - Tesselation - Displacement Maps - Hull Shader, Tesselator, Domain Shader
-Structured Buffers - bind as SRV or UAV
-Buffer Append/Consume
-Atomic Operations - PS & CS - Interlock Add, etc
-Compute Shader - GPGPU - post-processing, filtering, sorting, prep AI
-1-per-frame - full execution, loops, etc.
-Thread model - access to parallels - group & thread
-TLS (Thread Local Storage) - 32 KB - sync before data work
The Creation of a Kids' Virtual World - Real Data (Ridemakerz)
This talk was okay- there was quite a lot of ego and advertising, but at the very end we did get some real numbers.
Extend Experience
Players in free play can move to online micropayments, member revenue, or retail purchase
Players can become members by signing up directly, by online micropayments, or by retail purchase
Members have discounts on online micropayments and retail purchases
Make it Real didn't work -> Make it a Toy
Still unsure about free play before registration
Load swf's on demand
Make waiting fun
Real World Achievements - work on car with parent
$1/mo per user revenue
Revenue
5-10 sponsors/partners
Shop (micropayments for avatar changes) 5-8%
E-commerce 1-5%
Premium Member 1.5-3%
4 mo beta - 5045 registered (one of them was me, haha)
retail store coupons 60%
parent email response 20%
relogin 8%
level up 5%
Avoiding legal pitfalls in Virtual Worlds
This talk by Mark Methenitis (a lawyer from Dallas and IGDA) was pretty good, but like any law talk mostly focused on past legal cases and worries about video game patents.
worlds.com holds patents that are under scrutiny and may affect the virtual world space
other early starters include Meridian and AlphaWorld - 1995
copyright concerns
-ensure EULA has a clause to cover it if you allow user-generated content
-e.g. Marvel and City of Heroes (Marvel lost)
-have a contact to handle copyright claims
derivative works (mods, etc)
-ensure EULA/ToS is clear on who owns what and who is responsible for what
Illegal to have online gambling
-do not mix game economy with real world currency
Government plan for making money:
1. Make Rules
2. ??? -> Enforce
3. Profit
Governments are having trouble being able to tax online, so they are raising fines
-expect to be required to have stickers and standard terms
Discovering New Development Opportunities (Iwata keynote)
This excellent keynote gave great insights into the workings of Nintendo and how they succeed and are driving and supporting the industry. Iwata managed to show off his successes, have a positive, uplifting keynote, and show support for Nintendo developers, amazingly all without being too pretentious or seemingly offending anyone in the room. It probably helped that he gave away free copies of Rhythm Heaven at the end, haha.
Death Spiral
Financial Pressure -> Less Time -> Poorer Quality -> Less Sales -> Financial Pressure -> and on and on...
e.g. HAL Laboratories
-stick to the "core concept" - distortion leads to delay
-always comes from human observation
-they like this activity - why?
-Gardening -> Pikmin
-Puppies -> Nintendogs
-Excercise -> Wii Fit
-20% non-gamers
-50% increase in women gamers
-Miyamoto's personal life is now under NDA haha
Upward Spiral
Ideas -> Prototype -> Small Teams -> Multiple Projects -> Trial and Error -> Mass Production
Ideas are everywhere - always observe
Explain ideas personally - no design doc
Small teams - even 1 programmer
Miyamoto seems like perfectionist - but is judging the trial and error of each small project
-Kidnapping - randomly grab someone not on the team and have them play the game - over the shoulder observation
New ideas that surprise you are good
-Tsunku dance lessons demo -> Rhythm Heaven
WiiWare is 90% 3rd Party
New Wii support released
-HD SD Ram 32G channels
DSi demo
-animation maker
-eyetoy type game
My Lessons Learned from Flagship Studios
This was an excellent talk from an obviously humbled man who had a lot of important things to say. Mostly business lessons but good for everyone to know. Good speaker and kept audience attention well.
Flagship Studios: What happened?
July 2008 100+ employees laid off
Flagshipped - lost IPs -> creditors - controversy/bad blood
Made common mistakes
-why didn't we listen?
-just like VH1's behind the music, drugs, reunion, the whole deal
-so much optimism/hype
-inflated valuation
Failure is not an option... but it is a Grim Reality
-had no plan B
-just to survive is success right now
-scale it back
Know your economic model
-identify your first money in
-don't reinvent the wheel
-reeducation -> many steps -> $$$
-velvet rope - too much free area - not work in retail - should have gone with standard subscription
Don't do more than One New Thing
-Changing from developing something you're experienced with
-Changing to a new dev team
-Changing to a new genre
Limit Your Partnerships
-Each will have high expectations
-Team cannot say no (producer needs to watch for requests which are slowing the project and cut them off at the source)
Be careful with Multiple Territories
-N languages = N builds (and less polish for each)
-Each Region/Publisher wants "something special"
Infrastructure is Harder than you think
-Billing, Billing, Billing - learn from Jessica Mulligan
-Partner with good Ops - don't try to be an online publisher
-Customer Service Tools & billing are important features
Don't Believe the Hype
-Never stop doubting
-Slow roll marketing
-Sell! Your hype is always better than reality
-You usually get offered more before launch
If you're offered money, TAKE IT!!!
-Always there when you don't need it (buy shares, services)
-Unless you have 18 months of operating costs in the bank to burn (asked for audience raise of hands to see who had that- no one did)
-2008 VC: Red 5, Slipgate, Trion, Perpetual, etc. etc.
-25-30 mil -> stick in bank, delay launch, pay for delay penalties
- < 100% of something is better than > 100% of 0
-cash, equity okay
-we didn't take it because we thought we could make it on our own
See the difference between the forest and a tree
-Had no outside point of view
-Outsiders can make an impact
-Better band than a business
-get Board of Directors or Board of Advisors to be your outsiders
We're All in this Together
-Buy game to compete with others
-Don't wish failure on others
-Went down because didn't sell enough product
-others will die through no fault of their own
-support each other
-small budget can still get big audience
-500k copies (big for PC retail) - no subscription
-if you do microtransactions - run your operation super light
Solid Game Design (Kojima keynote)
This keynote was okay, and everyone has a writeup about it since it was during the main conference and nothing else was scheduled for the timeslot. Kojima joked that the only reason he came was because they said if he did, they would offer him an award. He offered many good insights hidden among a giant history lesson. It seemed like it would have been much more effective on a Japanese audience.
Making the Impossible Possible
-No creation yet has been truly revolutionary
-Barrier of Impossibility - make a game
Possible: done before
Impossible: not experienced
Discard Preconceived Notions - go around the wall - set up a new mission
Use tools (mario->mushroom - snake->ladder, box, etc.)
Other routes, new ideas, new vision
Barriers: Hardware Technology -> ground level
Software Technology can lift you above that somewhat
Game Design - new idea, tool - helps you get over the barrier
Mission: Create a combat game for the MSX2
-no sprites - limit - algorithm = chase down
-no combat -> escape -> hide -> !
-Metal Gear came about just because the hardware could not handle bullets
Design - ladder - sight range, change AI, "!" notify mechanism
MG2:SS - Evasion minimap, 3 alert modes, hearing and vision for AI
MGS sep, oct in US, 1998 - worldwide release - 3D area (ducts) - real time cutscenes - camera changes
MGS2 no new hardware
-go for immersion via game design
-shadows, AI, environmental effects (rain, fog lens), new player actions
-motion capture, puzzles, shooting
When designing, map out areas you have already explored and look for holes
-Metal Gear had not taken place outside much so MGS3 focused more on outside environments
MGS3 2004 new engine, survival, heal, open natural environments, capture food
MGS4 2008 Factions, Alliances - Japanese Review
Each time he showed the intro cutscene he expected people to laugh
Work together and support industry
A Whirled Tour
This incredible talk was chock full of useful information and practical data. The speaker went very fast so I was scrambling to take what notes I could.
Virtual World + Social Network + Casual Games Website
Coins - earned, Bars - real world currency
-economy was spiraling out of control until they introduced some items that can only be bought with bars
-limit earned coins to 600/day
-there is also Bling which content creators gain through sales- Bling can be converted to real world money
Creators can develop games, even MMOs to sell
Players can earn trophies
Item and Level packs are more sellable
Franchise merchandise also sells
Creators can develop avatars
Tech - Google Web Kit - Java - JavaScript - Flash - in-house Java server
Nodes - Rooms - individual servers that handle specific sets of tasks
LB Router - RPC - DOBJ (proprietary small message format)
Server infrastructure/colo: clients <-> S3 <-> FC <-> Nodes, LBR1, LBR2, BNode <-> BC <-> DB
IM is handled through 1-on-1 chats b/t nodes
Flash - 15-20 Whirled avatars before dying
Clients -> Node -> room data change rooms, change server nodes, pass around session data
Nodes share what room/game/thing it has constantly - manual/routing
Group chat = 1 Node hosts, sends to nodes with those channels
Distributed locking mechanism - before publishing node routing info
Clients have a many-to-many relationship with Nodes - Google Juice @Inject transient keyword
Amazon S3 - download - Remix - (Editors - can easily grab an image editor in flash - instructions to easily make an avatar with your head)
Creators that make games have access to an API that lets them award achievements (trophies), and prizes (pets, items)
Games sell content packs - stream from S3 (own mp3's) - customize MOBs, AVs, even Whirled GUI
Score ratings (keep a distribution, higher percent -> rating, easy to catch cheaters who go way above the bell curve)
Game Coin Budget - games can award this many coins, based on scores, duration of game, humanity (isBot), etc.
Protect from exploits - running unknown code on server(!) - Tamarin, Flash VM
all user-created games are run on secured firewalled server - S3, 80 machines, quotas - fail check - scale database
Alternate Virtual Reality Games DirectPlay ssh 47624
samskivert.com/work/2009/gdc/
Amazon ACC - TSUNG - EC2 - 35 I/O thread, DB thread, 2000 = 1 cpu - darkstar
Cinematic Next-Generation Action NARUTO
A great session with up front post-mortem level quality discussion. Many interesting techniques from real development.
CyberConnect2 - formed in 1996 - Kyuushuu - 109-120 employees
good corporate environment => good development
Sports - hard license
War - bad in Japan
Movie - Japan strengths - Anime, Manga
2006 - months, # of people
R&D - 6, 10 - 1 designer, artists, maybe 2 programmers
Proto - 6, 10
Base - 6, 24
Main - 6, 38
High Vol - 9, 65
Publisher progress - report every 6 months - document new effects and R&D
organize team with people best suited for the phase
Naruto Ultimate Ninja Storm Art
Character
-soft clean lively colors - bend head - normals - toon shading - emphasize chin
-3 LoD - 2.4k, 1.4k, and 7k - flatten eyes
-soft light shader (except areas with high chroma) - artist select outline shader
-52 22 tree 67 facial polygons - bend bones for exaggerated expressions - stretch tris for anime blur - free bones
Background
-hand drawn touch - silhouettes - 3D Max - special lighting shield - different vantage points
Effects
-Layer - ZSort no ZBuffer - 8-loop hachi_maru animations
-billboard fx inside simple geometry e.g. fireball sphere + billboard inside + animated flames
Video
-cinematics - script - match to game system, fx, mechanics, design
-director check
-licenser - check vs license
-prototype - pose only, get camera angle, timing, etc
-director check
-motion - full animations - imagery fix - white stand-in enemy
-director check
-publisher - check, edit, fix, finalize
Experimental Gameplay Session
I came to the last half of this session since it was happening at the same time as the CC2 session. I got the list of all the games from a friendly attendee. There were as usual many awesome new ideas presented and many inspiring moments throughout the whole session.
Here is the list and notes from the person I sat next to, Joe Mathes.
* <http://iandallas.com/games/
Game <http://iandallas.com/games/
* Shadow Physics
<http://www.avclub.com/
shadows cast actual 3d objects. The link is to an article that mentions it;
it doesn't seem to have a page of its own anywhere
* Miegakure <http://www.enquirerherald.
the 4D platformer that broke everyone's brains. As above, link is to an
article
* Spy Party
<http://www.eurogamer.net/
Game where you're trying to blend in with NPCs while carrying out missions,
and another player is trying to guess which NPC is you. As above, link is
to an article
* Moon Stories - A lot of different experimental gameplay ideas and
tiny games, most of them involving playing with time as a game mechanic and
romantic relationships also as a game mechanic. Here are links to three of
them that actually let you play: I wish I were the moon
<http://www.kongregate.com/
<http://www.ludomancy.com/
<http://www.ludomancy.com/
* Flower <http://en.wikipedia.org/wiki/
developers walked us through the evolution of this game's gameplay. The
endpoint is you fly around as a cloud of petals, collecting new petals that
give you powers, and spreading the petals and using them to pass obstacles.
Pretty, ambient, and not challenging. Like a kid's game.
* Achron <http://achrongame.com/> - The RTS where you can go back in
time or send things back in time. The most fun-looking and groundbreaking
of the lot IMHO.
* Rom Check Fail <http://rom-check-fail.en.
classic NES game hero up against a classic NES enemy. But which hero and
which both randomize every few seconds. Link is to a place where you can
download it.
* Where is my Heart
<http://bushghost.blogspot.
control 3 little monsters as they cooperate to get through levels. Similar
to the lost vikings
<http://www.blizzard.com/us/
presented on one screen in comic-book panels, and it's not clear without
exploration which panels connect to which others in what ways. Link is to a
place where you can download it.
* Closure <http://www.kongregate.com/
this, every level is dark, and there are few light sources. However, your
character does not physically interact with anything in the dark - so if you
move a light away from a wall, you can walk through the wall. Or fall off
the bottom of the screen, through the dark floor. Link is to its Kongregate
page, where you can play it
* Spelunky <http://forums.tigsource.com/
Actually, this talk was about roguelikes and extreme consequences in
general. The key point is that if the level is procedurally generated,
death is permanent, and you can't save your game, then every time you play
the game, that is the only time anyone will ever play the level you're on.
That makes it intense and important-feeling. This one was given by
Timothy's friend Derek Yu. Link is to tigsource, where you can download it.
Timothy does ops for tigsource.
Here are my notes on the ones that I got to see.
First half - Unfinished Swan, Shadow Physics, Miegakure 4D, Spy Party, Moon Stories
Second half
Flower - Jenova Chen
-flow +3D -AI
-safe, free, love - peace and harmony - petal blowing - growing - orbs
-many prototypes - mind-teleport - ground, seed, golf
-needed depth and challenge - collect petals, gain spells, time limit
Achron - in development for 10 years
-RTS where all units can time travel
-timewave (past changes gradually affect future)
-chrono energy - further back you travel, the higher the energy drain
-return to present to recharge
-achrongame.com
Closure - Tyler Glail
-borne out of a frustration with 'dark levels' - areas/rooms with only small light and limited vision
-idea - had to resort to puzzle game - can only interact with what you can see
Where is my Heart
-Comic Panel effect
-multi avatar
-one that can see dark world
Rom Check Fail
-Gameplay Variation
-standard pacing chart - gameplay variance induces spikes in intensity
-vary hero too, not just weapon or enemy
Roguelikes
-Rogue - 1980 - berkeley - permanent death + randomly generated levels
-chess rogue, gangsta rogue, real lives 2007, dwarf fortress, etc
-Spelunky - more approachable, platformer rogue
Negotiation 101
This was a great talk and had lots of good points that everyone seeking to have a good career should know.
First rule of negotiation is Preparation
-Negotiations can be won or lost before they even start
-Know thyself - objectives, parameters
-Plan B so you can walk out if offer is not good
-What will they want? Company & Person - know person's role
-Can you give what they could want?
-New terms added when agreed with lower peons
-Legal department = bad - only see risks
-talk to marketing!
-_Practice_
-intro, question, points, exits
-comfortable, confident
-Research culture issues
-cards for Japanese
-order in which to shake hands (leader first in China)
-Practice with big purchases (TV, car, etc.)
Negotiation
-in-person, remote? usually best is their place- they can't walk out on you in their own office
-make sure key decision makers are involved
-one person per party - less people = easier negotiations - see "Getting to Yes" Book
Strategies
-Soft - getting deal no matter what
-Hard - fight all points to get the best deal
-Hard is obviously better, but if everyone is hard all the time, nothing would ever get done
-Emphathize - discover actual interests - discuss interests, _not positions_
-Listen - blame? stay calm, just listen - "Make your fist in your pocket."
-Cooldown - keep up momentum
-if no deal, try to preserve the relationship
Social Games
Decent talk with some interesting games. Only caught part of this one as the conference was winding down.
Parking Wars
-parasite cheat (won't ticket you if you don't ticket me)
-fake accounts (park all there)
BackChannel
-comments on TV show while it is going - clicked ones grow
-similar tag matching
Kelly's Bags
-electrolux, social dilemma, events, being hunted, bags, choose the most popular one, you win
Iterative Level Design
Great talk from the Bioware guys on iterative level design. Also could only catch the end of this one.
Bioware - the Richards - nice guys
Corey Andruko - coray@bioware.com
Dusty Everman - dusty@bioware.com
Documentation
Mass Effect 1 - Kismet -> wiki export
Mass Effect 2 - SharePoint -> Perforce
var ra = new int[] { 0, 1, ..., N };
For multi-dimensional arrays it looks like this:
var ra = new []{new int[] { 0, 1, ..., N }, new int[] { 0, 1, ..., N } };
According to (http://community.bartdesmet.net/blogs/baint[] ra = new int[N]; ra[0] = 0; ra[1] = 1; ... ra[N] = N;The solution to question 2 is that you can't, at least not really. It looks like you have to create a class with each property you want, and then add an instance of that class to a List. Finally assign that List to a datagridview's DataSource property. Then it should be all linked up. You might have to Invalidate() the datagridview to get it to show your changes later as well. Here is some source code to illustrate creating a 9 by 9 grid. Enjoy!
(some class e.g. Form1)
{
(some function e.g. the contructor)
{
sudisplay.Add(new RowN());
sudisplay.Add(new RowN());
sudisplay.Add(new RowN());
sudisplay.Add(new RowN());
sudisplay.Add(new RowN());
sudisplay.Add(new RowN());
sudisplay.Add(new RowN());
sudisplay.Add(new RowN());
sudisplay.Add(new RowN());
dataGridView.DataSource = sudisplay;
}
}
public class RowN
{
public int col1 = 0;
public int C1
{
get { return col1; }
set { col1 = value; }
}
public int col2 = 0;
public int C2
{
get { return col2; }
set { col2 = value; }
}
public int col3 = 0;
public int C3
{
get { return col3; }
set { col3 = value; }
}
public int col4 = 0;
public int C4
{
get { return col4; }
set { col4 = value; }
}
public int col5 = 0;
public int C5
{
get { return col5; }
set { col5 = value; }
}
public int col6 = 0;
public int C6
{
get { return col6; }
set { col6 = value; }
}
public int col7 = 0;
public int C7
{
get { return col7; }
set { col7 = value; }
}
public int col8 = 0;
public int C8
{
get { return col8; }
set { col8 = value; }
}
public int col9 = 0;
public int C9
{
get { return col9; }
set { col9 = value; }
}
}
public class UnencapsulatedClass
{
int i = 5;
EncapsulatedClass ec;
public class EncapsulatedClass
{
int j = 9;
}
}
UnencapsulatedClass.class UnencapsulatedClass$EncapsulatedClass.class
No enclosing instance of type UnencapsulatedClass is available due to some intermediate constructor invocation
import package1.UnencapsulatedClass.EncapsulatedClass;
import package1.UnencapsulatedClass;
package package1;
public class Class1 {
/**
* @param args
*/
public static void main(String[] args)
{
System.out.println("hello vazor");
Class2 c = new Class1().new Class2();
c.callMe();
Class3.callStaticMe();
Class1.Class3.callStaticMe();
new Class3().ca();
new CrossPackageClass().callMe();
}
public class Class2
{
public void callMe()
{
System.out.println("called Me Class2!!!");
new CrossPackageClass().new CrossCrossCall().callMe();
}
}
public static class Class3
{
public static void callStaticMe()
{
System.out.println("called Static Me Class3");
}
public void ca()
{
System.out.println("called Me Class3");
}
}
}
package package1;
import package2.P2Class2;
import package2.P2Class;
public class CrossPackageClass {
public void callMe()
{
new P2Class2().callMe();
}
public class CrossCrossCall
{
public void callMe()
{
new P2Class().callMe();
}
}
}
package package1;
import package1.Class1;
public class UnencapsulatedClass {
int i = 5;
EncapsulatedClass ec;
public class EncapsulatedClass
{
int j = 9;
public void uecMe()
{
Class1.Class3.callStaticMe();
}
}
}
package package2;
public class P2Class {
public P2Class()
{
System.out.println("P2Class is being initialized!");
}
public void callMe()
{
System.out.println("P2Class callMe was called!!!!");
}
}
package package2;
public class P2Class2 extends P2Class {
public void callMe()
{
System.out.println("P2Class2 callMe was called!!");
new P2Class3().new CrazyClass().callMe();
}
}
package package2;
import package1.UnencapsulatedClass;
import package1.Class1;
//import package1.UnencapsulatedClass.EncapsulatedClass;
public class P2Class3 extends UnencapsulatedClass//EncapsulatedClass
{
EncapsulatedClass ec;
public class CrazyClass extends Class1
{
String s = "haha wow";
public void callMe()
{
new Class2().callMe();
}
}
}
hello vazor called Me Class2!!! P2Class is being initialized! P2Class callMe was called!!!! called Static Me Class3 called Static Me Class3 called Me Class3 P2Class is being initialized! P2Class2 callMe was called!! called Me Class2!!! P2Class is being initialized! P2Class callMe was called!!!!
#include <iostream>
using namespace std;
class Super
{
public:
Super()
{
superData = new char[ 256 ];
cout << "super allocated" << endl;
}
//virtual ~Super()
~Super()
{
delete [] superData;
cout << "super deleted" << endl;
}
virtual void func( void )
//void func( void )
{
cout << "super func" << endl;
}
private:
char *superData;
};
class Sub : public Super
{
public:
Sub()
{
subData = new char[ 512 ];
cout << "sub allocated" << endl;
}
~Sub()
{
delete [] subData;
cout << "sub deleted" << endl;
}
void func( void )
{
cout << "sub func" << endl;
//Super::func();
}
private:
char *subData;
};
int main(int argc, char* argv[])
{
Super* superSub = new Sub();
superSub->func();
delete superSub;
return 0;
}
super allocated sub allocated sub func super deleted
int array1[100];
for( int i=0; i<100; ++i )
array1[i] = i;
char* array2 = (char*)&array1;
char* array3 = (char*)array1;
cout << "array1:" << array1 << endl;
cout << "&array1:" << &array1 << endl;
cout << "&array2:" << &array2 << endl;
cout << "&array3:" << &array3 << endl;
cout << "array2[46]:" << (int)(array2[46]) << endl;
cout << "array2[47]:" << (int)(array2[47]) << endl;
cout << "array2[48]:" << (int)(array2[48]) << endl;
cout << "array2[49]:" << (int)(array2[49]) << endl;
cout << "array2[50]:" << (int)(array2[50]) << endl;
cout << "array2[51]:" << (int)(array2[51]) << endl;
cout << "array2[52]:" << (int)(array2[52]) << endl;
cout << "array3[46]:" << (int)(array3[46]) << endl;
cout << "array3[47]:" << (int)(array3[47]) << endl;
cout << "array3[48]:" << (int)(array3[48]) << endl;
cout << "array3[49]:" << (int)(array3[49]) << endl;
cout << "array3[50]:" << (int)(array3[50]) << endl;
cout << "array3[51]:" << (int)(array3[51]) << endl;
cout << "array3[52]:" << (int)(array3[52]) << endl;
cout << "array3[53]:" << (int)(array3[53]) << endl;
cout << "array3[54]:" << (int)(array3[54]) << endl;
array1:0x22fde0 (or whereever your computer puts it) &array1:0x22fde0 &array2:0x22fddc &array3:0x22fdd8 array2[46]:0 array2[47]:0 array2[48]:12 array2[49]:0 array2[50]:0 array2[51]:0 array2[52]:13 array3[46]:0 array3[47]:0 array3[48]:12 array3[49]:0 array3[50]:0 array3[51]:0 array3[52]:13 array3[53]:0 array3[54]:0